gitlab-org--gitlab-foss/config/object_store_settings.rb
Dmitriy Zaporozhets edf1c1fccf Make ObjectStoreSettings use more explicit and add specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-07-24 14:44:44 +03:00

15 lines
669 B
Ruby

# Set default values for object_store settings
class ObjectStoreSettings
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