DEV: Bump rails_failover.

DEV: Bump rails_failover.

Avoid configuring AR stuff if replica_host and replica_port hasn’t been provided.

diff --git a/Gemfile.lock b/Gemfile.lock
index 7dc6cdc..7e5e5ee 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -280,7 +280,7 @@ GEM
       nokogiri (>= 1.6)
     rails-html-sanitizer (1.3.0)
       loofah (~> 2.3)
-    rails_failover (0.5.0)
+    rails_failover (0.5.1)
       activerecord (~> 6.0)
       railties (~> 6.0)
     rails_multisite (2.3.0)
diff --git a/config/initializers/002-rails_failover.rb b/config/initializers/002-rails_failover.rb
index d414a86..16c5dc4 100644
--- a/config/initializers/002-rails_failover.rb
+++ b/config/initializers/002-rails_failover.rb
@@ -1,5 +1,7 @@
 # frozen_string_literal: true
 
+return unless Rails.configuration.active_record_rails_failover
+
 if defined?(RailsFailover::Redis)
   message_bus_keepalive_interval = nil
 
diff --git a/config/initializers/200-first_middlewares.rb b/config/initializers/200-first_middlewares.rb
index e326e52..3f2bce1 100644
--- a/config/initializers/200-first_middlewares.rb
+++ b/config/initializers/200-first_middlewares.rb
@@ -25,9 +25,9 @@ if Rails.configuration.multisite
   Rails.configuration.middleware.unshift RailsMultisite::Middleware, RailsMultisite::DiscoursePatches.config
   Rails.configuration.middleware.delete ActionDispatch::Executor
 
-  if defined?(RailsFailover)
+  if defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
     Rails.configuration.middleware.insert_after(RailsMultisite::Middleware, RailsFailover::ActiveRecord::Middleware)
   end
-elsif defined?(RailsFailover)
+elsif defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
   Rails.configuration.middleware.insert_before(MessageBus::Rack::Middleware, RailsFailover::ActiveRecord::Middleware)
 end

GitHub sha: 092ae858