summaryrefslogtreecommitdiff
path: root/lib/ci/current_settings.rb
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2015-09-16 19:54:18 -0500
committerPatricio Cano <suprnova32@gmail.com>2015-09-16 19:54:18 -0500
commit1ddefa3beabed00f08c893ca66b9f004e3b4e4df (patch)
tree12c0546f4246b8ee5090c32996f3301207bcf93f /lib/ci/current_settings.rb
parent1ef2ce95d507c3d21598f26dd8a0e77dfc3c33cf (diff)
parentcac969229aab74ab5dcd7682c4f1c3a74a17b9d6 (diff)
downloadgitlab-ce-1ddefa3beabed00f08c893ca66b9f004e3b4e4df.tar.gz
Merge branch 'master' into notification-levels
Diffstat (limited to 'lib/ci/current_settings.rb')
-rw-r--r--lib/ci/current_settings.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ci/current_settings.rb b/lib/ci/current_settings.rb
new file mode 100644
index 00000000000..fd78b024970
--- /dev/null
+++ b/lib/ci/current_settings.rb
@@ -0,0 +1,22 @@
+module Ci
+ module CurrentSettings
+ def current_application_settings
+ key = :ci_current_application_settings
+
+ RequestStore.store[key] ||= begin
+ if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('ci_application_settings')
+ Ci::ApplicationSetting.current || Ci::ApplicationSetting.create_from_defaults
+ else
+ fake_application_settings
+ end
+ end
+ end
+
+ def fake_application_settings
+ OpenStruct.new(
+ all_broken_builds: Ci::Settings.gitlab_ci['all_broken_builds'],
+ add_pusher: Ci::Settings.gitlab_ci['add_pusher'],
+ )
+ end
+ end
+end