only use the db follower if use_database_follower is set in the config
This commit is contained in:
parent
23f3edc60c
commit
407a08f644
|
@ -118,21 +118,8 @@ module Travis::Api
|
||||||
|
|
||||||
def self.setup_travis
|
def self.setup_travis
|
||||||
Travis::Amqp.config = Travis.config.amqp
|
Travis::Amqp.config = Travis.config.amqp
|
||||||
Travis::Database.connect
|
|
||||||
|
|
||||||
if Travis.env == 'production' || Travis.env == 'staging'
|
setup_database_connections
|
||||||
# Octopus checks for Rails.env, just hardcode enabled?
|
|
||||||
Octopus.instance_eval do
|
|
||||||
def enabled?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
ActiveRecord::Base.custom_octopus_connection = false
|
|
||||||
::Octopus.setup do |config|
|
|
||||||
config.shards = { :follower => Travis.config.database_follower }
|
|
||||||
config.environments = ['production', 'staging']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Travis::Features.start
|
Travis::Features.start
|
||||||
|
|
||||||
|
@ -152,6 +139,26 @@ module Travis::Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.setup_database_connections
|
||||||
|
Travis::Database.connect
|
||||||
|
|
||||||
|
return unless Travis.config.use_database_follower?
|
||||||
|
|
||||||
|
if Travis.env == 'production' || Travis.env == 'staging'
|
||||||
|
# Octopus checks for Rails.env, just hardcode enabled?
|
||||||
|
Octopus.instance_eval do
|
||||||
|
def enabled?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ActiveRecord::Base.custom_octopus_connection = false
|
||||||
|
::Octopus.setup do |config|
|
||||||
|
config.shards = { :follower => Travis.config.database_follower }
|
||||||
|
config.environments = ['production', 'staging']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.load_endpoints
|
def self.load_endpoints
|
||||||
Backports.require_relative_dir 'app/middleware'
|
Backports.require_relative_dir 'app/middleware'
|
||||||
Backports.require_relative_dir 'app/endpoint'
|
Backports.require_relative_dir 'app/endpoint'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user