diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/api/api.rb | 4 | ||||
-rw-r--r-- | lib/ci/api/helpers.rb | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/ci/api/api.rb b/lib/ci/api/api.rb index 172c6f22164..7bb8869d61a 100644 --- a/lib/ci/api/api.rb +++ b/lib/ci/api/api.rb @@ -23,6 +23,10 @@ module Ci rack_response({ 'message' => '500 Internal Server Error' }, 500) end + before do + check_enable_flag! + end + format :json helpers Helpers diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index e602cda81d6..8e893aa5cc6 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -3,6 +3,12 @@ module Ci module Helpers UPDATE_RUNNER_EVERY = 60 + def check_enable_flag! + unless current_application_settings.ci_enabled + render_api_error!('400 (Bad request) CI is disabled', 400) + end + end + def authenticate_runners! forbidden! unless params[:token] == GitlabCi::REGISTRATION_TOKEN end |