Commit 3a8773fb authored by Marin Jankovski's avatar Marin Jankovski

Added USE_DB env var to allow loading fake settings without db running.

parent aa1c3214
...@@ -28,6 +28,7 @@ v 8.0.0 (unreleased) ...@@ -28,6 +28,7 @@ v 8.0.0 (unreleased)
- Fixed login failure when extern_uid changes (Joel Koglin) - Fixed login failure when extern_uid changes (Joel Koglin)
- Don't notify users without access to the project when they are (accidentally) mentioned in a note. - Don't notify users without access to the project when they are (accidentally) mentioned in a note.
- Retrieving oauth token with LDAP credentials - Retrieving oauth token with LDAP credentials
- Load Application settings from running database unless env var USE_DB=false
v 7.14.1 v 7.14.1
- Improve abuse reports management from admin area - Improve abuse reports management from admin area
......
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
key = :current_application_settings key = :current_application_settings
RequestStore.store[key] ||= begin RequestStore.store[key] ||= begin
if ActiveRecord::Base.connection.active? && ActiveRecord::Base.connection.table_exists?('application_settings') if connect_to_db?
ApplicationSetting.current || ApplicationSetting.create_from_defaults ApplicationSetting.current || ApplicationSetting.create_from_defaults
else else
fake_application_settings fake_application_settings
...@@ -26,5 +26,17 @@ module Gitlab ...@@ -26,5 +26,17 @@ module Gitlab
import_sources: Settings.gitlab['import_sources'] import_sources: Settings.gitlab['import_sources']
) )
end end
private
def connect_to_db?
use_db = if ENV['USE_DB'] == "false"
false
else
true
end
use_db && ActiveRecord::Base.connection.active? && ActiveRecord::Base.connection.table_exists?('application_settings')
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment