summaryrefslogtreecommitdiff
path: root/db/fixtures/production/010_settings.rb
blob: 7626cdb0b9c9861ef7f0fb6d0e4d544d11cdc70d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def save(settings, topic)
  if settings.save
    puts "Saved #{topic}".color(:green)
  else
    puts "Could not save #{topic}".color(:red)
    puts
    settings.errors.full_messages.map do |message|
      puts "--> #{message}".color(:red)
    end
    puts
    exit(1)
  end
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?
  settings = Gitlab::CurrentSettings.current_application_settings
  value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) || false
  settings.prometheus_metrics_enabled = value
  save(settings, 'Prometheus metrics enabled flag')
end