diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 15:25:54 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 19:46:29 +0200 |
commit | 6a67148ed3543ee5073ab49dc4e825f3d87cc8b5 (patch) | |
tree | cacf11c4f156dbcf0cc4536ef68be8943b80455f /db | |
parent | c86e1437eb415e816dcc29f0b1acafeed2dcc266 (diff) | |
download | gitlab-ce-6a67148ed3543ee5073ab49dc4e825f3d87cc8b5.tar.gz |
Make production settings fixture use Gitlab::CurrentSettings.current_application_settings
small code formatting changes
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/production/010_settings.rb | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb index ed0718e7fa9..a81782d16ff 100644 --- a/db/fixtures/production/010_settings.rb +++ b/db/fixtures/production/010_settings.rb @@ -12,18 +12,15 @@ def save(settings, topic) end end -envs = %w{ GITLAB_PROMETHEUS_METRICS_ENABLED GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN } - -if envs.any? {|env_name| ENV[env_name].present? } - settings = ApplicationSetting.current || ApplicationSetting.create_from_defaults - if ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'].present? - settings.set_runners_registration_token(ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN']) - save(settings, 'Runner Registration Token') - end +if ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'].present? + settings = Gitlab::CurrentSettings.current_application_settings + settings.set_runners_registration_token(ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN']) + save(settings, 'Runner Registration Token') +end - if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present? - value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) - settings.prometheus_metrics_enabled = value - save(settings, 'Prometheus metrics enabled flag') - end +if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present? + settings = Gitlab::CurrentSettings.current_application_settings + value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) + settings.prometheus_metrics_enabled = value + save(settings, 'Prometheus metrics enabled flag') end |