summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-07-23 17:33:06 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-07-24 14:44:44 +0300
commitedf1c1fccf156b8789814be80f3a17b57afd38d1 (patch)
tree2de1d3824f0c67c8e6ba4bec0d35c843ab49bb4e /config
parenta3f1592b898ce01bcf516ba0d16a4606868c2743 (diff)
downloadgitlab-ce-edf1c1fccf156b8789814be80f3a17b57afd38d1.tar.gz
Make ObjectStoreSettings use more explicit and add specsdz-refactor-object-store-settings
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/initializers/1_settings.rb11
-rw-r--r--config/object_store_settings.rb4
2 files changed, 8 insertions, 7 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 0ecfef0d0fc..3230d9c0a5b 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -1,4 +1,5 @@
require_relative '../settings'
+require_relative '../object_store_settings'
# Default settings
Settings['ldap'] ||= Settingslogic.new({})
@@ -170,8 +171,6 @@ Settings.gitlab_ci['url'] ||= Settings.__send__(:build_gitlab_ci
Settings['incoming_email'] ||= Settingslogic.new({})
Settings.incoming_email['enabled'] = false if Settings.incoming_email['enabled'].nil?
-
-
#
# Build Artifacts
#
@@ -181,8 +180,7 @@ Settings.artifacts['storage_path'] = Settings.absolute(Settings.artifacts.values
# Settings.artifact['path'] is deprecated, use `storage_path` instead
Settings.artifacts['path'] = Settings.artifacts['storage_path']
Settings.artifacts['max_size'] ||= 100 # in megabytes
-ObjectStoreSettings.new(Settings.artifacts['object_store'])
-
+Settings.artifacts['object_store'] = ObjectStoreSettings.parse(Settings.artifacts['object_store'])
#
# Registry
@@ -221,7 +219,7 @@ Settings.pages.admin['certificate'] ||= ''
Settings['lfs'] ||= Settingslogic.new({})
Settings.lfs['enabled'] = true if Settings.lfs['enabled'].nil?
Settings.lfs['storage_path'] = Settings.absolute(Settings.lfs['storage_path'] || File.join(Settings.shared['path'], "lfs-objects"))
-ObjectStoreSettings.new(Settings.lfs['object_store'])
+Settings.lfs['object_store'] = ObjectStoreSettings.parse(Settings.lfs['object_store'])
#
# Uploads
@@ -229,7 +227,8 @@ ObjectStoreSettings.new(Settings.lfs['object_store'])
Settings['uploads'] ||= Settingslogic.new({})
Settings.uploads['storage_path'] = Settings.absolute(Settings.uploads['storage_path'] || 'public')
Settings.uploads['base_dir'] = Settings.uploads['base_dir'] || 'uploads/-/system'
-ObjectStoreSettings.new(Settings.uploads['object_store'])
+Settings.uploads['object_store'] = ObjectStoreSettings.parse(Settings.uploads['object_store'])
+Settings.uploads['object_store']['remote_directory'] ||= 'uploads'
#
# Mattermost
diff --git a/config/object_store_settings.rb b/config/object_store_settings.rb
index 7bf05622bac..d85ff394dcc 100644
--- a/config/object_store_settings.rb
+++ b/config/object_store_settings.rb
@@ -1,13 +1,15 @@
# Set default values for object_store settings
class ObjectStoreSettings
- def initialize(object_store)
+ def self.parse(object_store)
object_store ||= Settingslogic.new({})
object_store['enabled'] = false if object_store['enabled'].nil?
object_store['remote_directory'] ||= nil
object_store['direct_upload'] = false if object_store['direct_upload'].nil?
object_store['background_upload'] = true if object_store['background_upload'].nil?
object_store['proxy_download'] = false if object_store['proxy_download'].nil?
+
# Convert upload connection settings to use string keys, to make Fog happy
object_store['connection']&.deep_stringify_keys!
+ object_store
end
end