summaryrefslogtreecommitdiff
path: root/app/uploaders/gitlab_uploader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/uploaders/gitlab_uploader.rb')
-rw-r--r--app/uploaders/gitlab_uploader.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb
index 62024bff4c0..2eb34288bd7 100644
--- a/app/uploaders/gitlab_uploader.rb
+++ b/app/uploaders/gitlab_uploader.rb
@@ -3,7 +3,7 @@
class GitlabUploader < CarrierWave::Uploader::Base
include ContentTypeWhitelist::Concern
- class_attribute :options
+ class_attribute :storage_location_identifier
PROTECTED_METHODS = %i(filename cache_dir work_dir store_dir).freeze
@@ -11,8 +11,13 @@ class GitlabUploader < CarrierWave::Uploader::Base
class << self
# DSL setter
- def storage_options(options)
- self.options = options
+ def storage_location(location)
+ self.storage_location_identifier = location
+ _ = options # Ensures that we have a valid storage_location_identifier
+ end
+
+ def options
+ ObjectStorage::Config::LOCATIONS.fetch(storage_location_identifier)
end
def root
@@ -41,7 +46,7 @@ class GitlabUploader < CarrierWave::Uploader::Base
end
end
- storage_options Gitlab.config.uploads
+ storage_location :uploads
delegate :base_dir, :file_storage?, to: :class
@@ -51,6 +56,10 @@ class GitlabUploader < CarrierWave::Uploader::Base
super(model, mounted_as)
end
+ def options
+ self.class.options
+ end
+
def file_cache_storage?
cache_storage.is_a?(CarrierWave::Storage::File)
end