2017-09-10 17:25:29 +05:30
|
|
|
def save(settings, topic)
|
2017-08-17 22:00:37 +05:30
|
|
|
if settings.save
|
2017-09-10 17:25:29 +05:30
|
|
|
puts "Saved #{topic}".color(:green)
|
2017-08-17 22:00:37 +05:30
|
|
|
else
|
2017-09-10 17:25:29 +05:30
|
|
|
puts "Could not save #{topic}".color(:red)
|
2017-08-17 22:00:37 +05:30
|
|
|
puts
|
|
|
|
settings.errors.full_messages.map do |message|
|
|
|
|
puts "--> #{message}".color(:red)
|
|
|
|
end
|
|
|
|
puts
|
2017-09-10 17:25:29 +05:30
|
|
|
exit(1)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
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
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
settings = Gitlab::CurrentSettings.current_application_settings
|
|
|
|
settings.ci_jwt_signing_key = OpenSSL::PKey::RSA.new(2048).to_pem
|
|
|
|
save(settings, 'CI JWT signing key')
|