Move the database configuration check to Gitlab::Geo

parent 35eb90d4
class Geo::BaseRegistry < ActiveRecord::Base
self.abstract_class = true
if Rails.configuration.respond_to?(:geo_database) && (Gitlab::Geo.secondary? || Rails.env.test?)
if Gitlab::Geo.configuration_available? && (Gitlab::Geo.secondary? || Rails.env.test?)
establish_connection Rails.configuration.geo_database
end
end
......@@ -6,7 +6,7 @@ class GeoBackfillWorker
BATCH_SIZE = 100.freeze
def perform
return unless Rails.configuration.respond_to?(:geo_database)
return unless Gitlab::Geo.configuration_available?
return unless Gitlab::Geo.primary_node.present?
start_time = Time.now
......
......@@ -29,6 +29,10 @@ module Gitlab
Gitlab::Geo.current_node.reload.enabled?
end
def self.configuration_available?
Rails.configuration.respond_to?(:geo_database)
end
def self.license_allows?
::License.current && ::License.current.add_on?('GitLab_Geo')
end
......
......@@ -3,7 +3,7 @@ module Gitlab
class HealthCheck
def self.perform_checks
return '' unless Gitlab::Geo.secondary?
return 'The Geo database configuration file is missing.' unless Rails.configuration.respond_to?(:geo_database)
return 'The Geo database configuration file is missing.' unless Gitlab::Geo.configuration_available?
database_version = self.get_database_version.to_i
migration_version = self.get_migration_version.to_i
......
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