diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/carrierwave_patch.rb | 29 | ||||
-rw-r--r-- | config/initializers/fog_google_https_private_urls.rb | 2 | ||||
-rw-r--r-- | config/initializers/lograge.rb | 3 |
3 files changed, 32 insertions, 2 deletions
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb new file mode 100644 index 00000000000..35ffff03abe --- /dev/null +++ b/config/initializers/carrierwave_patch.rb @@ -0,0 +1,29 @@ +# This monkey patches CarrierWave 1.2.3 to make Google Cloud Storage work with +# extra query parameters: +# https://github.com/carrierwaveuploader/carrierwave/pull/2332/files +module CarrierWave + module Storage + class Fog < Abstract + class File + def authenticated_url(options = {}) + if %w(AWS Google Rackspace OpenStack).include?(@uploader.fog_credentials[:provider]) + # avoid a get by using local references + local_directory = connection.directories.new(key: @uploader.fog_directory) + local_file = local_directory.files.new(key: path) + expire_at = ::Fog::Time.now + @uploader.fog_authenticated_url_expiration + case @uploader.fog_credentials[:provider] + when 'AWS', 'Google' + local_file.url(expire_at, options) + when 'Rackspace' + connection.get_object_https_url(@uploader.fog_directory, path, expire_at, options) + when 'OpenStack' + connection.get_object_https_url(@uploader.fog_directory, path, expire_at) + else + local_file.url(expire_at) + end + end + end + end + end + end +end diff --git a/config/initializers/fog_google_https_private_urls.rb b/config/initializers/fog_google_https_private_urls.rb index c65a534b536..682b1050c68 100644 --- a/config/initializers/fog_google_https_private_urls.rb +++ b/config/initializers/fog_google_https_private_urls.rb @@ -9,7 +9,7 @@ module Fog module MonkeyPatch def url(expires, options = {}) requires :key - collection.get_https_url(key, expires) + collection.get_https_url(key, expires, options) end end diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb index 1cf8a24e98c..840404e0ec0 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -22,7 +22,8 @@ unless Sidekiq.server? params: params, remote_ip: event.payload[:remote_ip], user_id: event.payload[:user_id], - username: event.payload[:username] + username: event.payload[:username], + ua: event.payload[:ua] } gitaly_calls = Gitlab::GitalyClient.get_request_count |