2017-06-02 07:41:30 -04:00
|
|
|
def save(settings, topic)
|
2016-10-02 18:30:44 -04:00
|
|
|
if settings.save
|
2017-06-02 07:41:30 -04:00
|
|
|
puts "Saved #{topic}".color(:green)
|
2016-10-02 18:30:44 -04:00
|
|
|
else
|
2017-06-02 07:41:30 -04:00
|
|
|
puts "Could not save #{topic}".color(:red)
|
2016-10-02 18:30:44 -04:00
|
|
|
puts
|
|
|
|
settings.errors.full_messages.map do |message|
|
|
|
|
puts "--> #{message}".color(:red)
|
|
|
|
end
|
|
|
|
puts
|
2017-06-02 07:41:30 -04:00
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-06-02 09:25:54 -04:00
|
|
|
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
|
2017-06-02 07:41:30 -04:00
|
|
|
|
2017-06-02 09:25:54 -04:00
|
|
|
if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present?
|
|
|
|
settings = Gitlab::CurrentSettings.current_application_settings
|
2017-06-06 07:16:55 -04:00
|
|
|
value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) || false
|
2017-06-02 09:25:54 -04:00
|
|
|
settings.prometheus_metrics_enabled = value
|
|
|
|
save(settings, 'Prometheus metrics enabled flag')
|
2016-10-02 18:30:44 -04:00
|
|
|
end
|