Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-18 11:19:08 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-18 13:46:47 +0300
commite41a29b0c381458f789d62cfeb9ad94920f78804 (patch)
treea4fc62468ad98fdff7b475906acf4ef048c209a4 /lib
parent1eb3dde45b55afb723954e577b7bd12946aeb3ca (diff)
Allow to disable GitLab CI
Diffstat (limited to 'lib')
-rw-r--r--lib/ci/api/api.rb4
-rw-r--r--lib/ci/api/helpers.rb4
2 files changed, 8 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..13aa71f4630 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -3,6 +3,10 @@ module Ci
module Helpers
UPDATE_RUNNER_EVERY = 60
+ def check_enable_flag!
+ not_found! unless current_application_settings.ci_enabled
+ end
+
def authenticate_runners!
forbidden! unless params[:token] == GitlabCi::REGISTRATION_TOKEN
end