diff options
Diffstat (limited to 'lib/ci/api/helpers.rb')
-rw-r--r-- | lib/ci/api/helpers.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 9891b5e38ea..443563c2e4a 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -6,7 +6,7 @@ module Ci UPDATE_RUNNER_EVERY = 60 def authenticate_runners! - forbidden! unless params[:token] == GitlabCi::REGISTRATION_TOKEN + forbidden! unless runner_registration_token_valid? end def authenticate_runner! @@ -18,6 +18,10 @@ module Ci forbidden! unless token && build.valid_token?(token) end + def runner_registration_token_valid? + params[:token] == current_application_settings.ensure_runners_registration_token + end + def update_runner_last_contact # Use a random threshold to prevent beating DB updates contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY) |