From d307115d61417787770b92f0c3e13fd48f081dac Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Mon, 8 Jan 2024 20:58:16 -0800 Subject: [PATCH] Another attempt for a new error --- lib/knockoff/config.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 2124c06..7613fef 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -53,7 +53,7 @@ def properly_configured? private def update_replica_config(key, updated_config) - @replicas_configurations[key].merge!(updated_config) + @replicas_configurations[key] = @replicas_configurations[key].configuration_hash.deep_dup.merge!(updated_config) ActiveRecord::Base.configurations.configurations << @replicas_configurations[key] end @@ -90,14 +90,12 @@ def register_replica_copy(index, env_key, configuration_hash) key = "knockoff_replica_#{index}" new_config = create_replica_copy(env_key, key, configuration_hash.deep_dup) ActiveRecord::Base.configurations.configurations << new_config - @replicas_configurations[key] = new_config.configuration_hash.deep_dup + @replicas_configurations[key] = new_config end def create_replica_copy(env_key, key, replica_config_hash) uri = URI.parse(ENV[env_key]) - puts uri - replica_config_hash[:adapter] = if uri.scheme == "postgres" 'postgresql' @@ -114,9 +112,6 @@ def create_replica_copy(env_key, key, replica_config_hash) replica_config_hash[:host] = uri.host replica_config_hash[:port] = uri.port end - - puts (uri.path || "").split("/")[1] - puts replica_config_hash ActiveRecord::DatabaseConfigurations::HashConfig.new(key, key, replica_config_hash) end