Load Geo DB only when Geo database config file exist

parent 80f6662a
......@@ -158,8 +158,5 @@ module Gitlab
config.generators do |g|
g.factory_girl false
end
# This is needed for GitLab Geo
config.assets.initialize_on_precompile = false
end
end
if Gitlab::Geo.secondary?
if File.exist?(Rails.root.join('config/database_geo.yml'))
Rails.application.configure do
config.geo_database = config_for(:database_geo)
end
......
......@@ -2,9 +2,7 @@ HealthCheck.setup do |config|
config.standard_checks = %w(database migrations cache)
config.full_checks = %w(database migrations cache)
if Gitlab::Geo.secondary?
config.add_custom_check('geo') do
Gitlab::Geo::HealthCheck.perform_checks
end
config.add_custom_check('geo') do
Gitlab::Geo::HealthCheck.perform_checks
end
end
......@@ -19,7 +19,7 @@ module Gitlab
end
def self.enabled?
self.cache_value(:geo_node_enabled) { self.connected_to_primary_db? && GeoNode.exists? }
self.cache_value(:geo_node_enabled) { GeoNode.exists? }
end
def self.license_allows?
......@@ -80,10 +80,5 @@ module Gitlab
# urlsafe_base64 may return a string of size * 4/3
SecureRandom.urlsafe_base64(size)[0, size]
end
def self.connected_to_primary_db?
ActiveRecord::Base.connection.active? &&
ActiveRecord::Base.connection.table_exists?(GeoNode.table_name)
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