diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-07-30 12:16:08 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-07-30 12:23:25 +0200 |
commit | 861dd8ff0010436c882ebe1ccfa448a0a3029116 (patch) | |
tree | 20261417b95703395b313faa574595105e7e46ab /lib | |
parent | 6ec3f9873a61449e50521face3a1b32b03eb9feb (diff) | |
download | gitlab-ci-861dd8ff0010436c882ebe1ccfa448a0a3029116.tar.gz |
Added Application Settings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/current_settings.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/current_settings.rb b/lib/current_settings.rb new file mode 100644 index 0000000..59dedfd --- /dev/null +++ b/lib/current_settings.rb @@ -0,0 +1,20 @@ +module CurrentSettings + def current_application_settings + key = :current_application_settings + + RequestStore.store[key] ||= begin + if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('application_settings') + ApplicationSetting.current || ApplicationSetting.create_from_defaults + else + fake_application_settings + end + end + end + + def fake_application_settings + OpenStruct.new( + all_broken_builds: Settings.gitlab_ci['all_broken_builds'], + add_pusher: Settings.gitlab_ci['add_pusher'], + ) + end +end |