diff options
-rw-r--r-- | config/initializers/1_settings.rb | 6 | ||||
-rw-r--r-- | spec/initializers/settings_spec.rb | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 5de46eddab6..abaabad5d65 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -440,7 +440,9 @@ unless Settings.repositories.storages['default'] Settings.repositories.storages['default']['path'] ||= Settings.gitlab['user_home'] + '/repositories/' end -Settings.repositories.storages.values.each do |storage| +Settings.repositories.storages.each do |key, storage| + storage = Settingslogic.new(storage) + # Expand relative paths storage['path'] = Settings.absolute(storage['path']) # Set failure defaults @@ -454,6 +456,8 @@ Settings.repositories.storages.values.each do |storage| storage['failure_reset_time'] = storage['failure_reset_time'].to_i # We might want to have a timeout shorter than 1 second. storage['storage_timeout'] = storage['storage_timeout'].to_f + + Settings.repositories.storages[key] = storage end # diff --git a/spec/initializers/settings_spec.rb b/spec/initializers/settings_spec.rb index 092e8c0381c..9a974e70e8c 100644 --- a/spec/initializers/settings_spec.rb +++ b/spec/initializers/settings_spec.rb @@ -27,6 +27,15 @@ describe Settings do expect(repository_settings['failure_reset_time']).to eq(1800) expect(repository_settings['storage_timeout']).to eq(5) end + + it 'can be accessed with dot syntax all the way down' do + expect(Gitlab.config.repositories.storages.broken.failure_count_threshold).to eq(10) + end + + it 'can be accessed in a very specific way that breaks without reassigning each element with Settingslogic' do + storage_settings = Gitlab.config.repositories.storages['broken'] + expect(storage_settings.failure_count_threshold).to eq(10) + end end describe '#host_without_www' do |