gitlab-org--gitlab-foss/db/fixtures/production/010_settings.rb
DJ Mountney fb5f7733f1 Allow users to seed the initial runner registration token using an environment variable
This is useful for when runner is bundled with gitlab, like in a kubernetes stack, and we want the runner to be able to
register with gitlab as soon as they both come up.
2016-12-01 17:21:21 -08:00

16 lines
520 B
Ruby

if ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'].present?
settings = ApplicationSetting.current || ApplicationSetting.create_from_defaults
settings.set_runners_registration_token(ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'])
if settings.save
puts "Saved Runner Registration Token".color(:green)
else
puts "Could not save Runner Registration Token".color(:red)
puts
settings.errors.full_messages.map do |message|
puts "--> #{message}".color(:red)
end
puts
exit 1
end
end