only use the db follower if use_database_follower is set in the config

This commit is contained in:
Josh Kalderimis 2013-05-03 09:42:07 +02:00
parent 23f3edc60c
commit 407a08f644

View File

@ -118,21 +118,8 @@ module Travis::Api
def self.setup_travis
Travis::Amqp.config = Travis.config.amqp
Travis::Database.connect
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
setup_database_connections
Travis::Features.start
@ -152,6 +139,26 @@ module Travis::Api
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
Backports.require_relative_dir 'app/middleware'
Backports.require_relative_dir 'app/endpoint'