diff options
| author | Douwe Maan <douwe@gitlab.com> | 2015-08-25 18:42:46 -0700 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2015-08-25 18:42:46 -0700 |
| commit | 046b28312704f3131e72dcd2dbdacc5264d4aa62 (patch) | |
| tree | a8c2b14a6e1db3b662fee2c79af70d9fcb643c2e /lib/ci/current_settings.rb | |
| parent | e449426a4e7d15cdd582d4f136add52cbfb5e04e (diff) | |
| download | gitlab-ce-046b28312704f3131e72dcd2dbdacc5264d4aa62.tar.gz | |
Groundwork for merging CI into CE
Diffstat (limited to 'lib/ci/current_settings.rb')
| -rw-r--r-- | lib/ci/current_settings.rb | 22 |
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 |
