From 876cd657e4ed6d5ac3c68e474d5001b5910b6791 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Tue, 9 Jan 2024 15:52:00 -0800 Subject: [PATCH] potential fix for rails 6.0 issue --- lib/knockoff/config.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 74adea9..a303430 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -35,7 +35,7 @@ def replica_env_keys def update_replica_configs(new_configs) if ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').present? - updated_config = new_configs.deep_dup.merge!(ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').first.configuration_hash) + updated_config = new_configs.deep_dup.merge!(ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').first.to_h) end @replicas_configurations.each do |key, _config| @@ -53,7 +53,7 @@ def properly_configured? private def update_replica_config(key, updated_config) - merged_config = @replicas_configurations[key].configuration_hash.deep_dup.merge!(updated_config) + merged_config = @replicas_configurations[key].to_h.deep_dup.merge!(updated_config) @replicas_configurations[key] = ActiveRecord::DatabaseConfigurations::HashConfig.new(key, key, merged_config) ActiveRecord::Base.configurations.configurations << @replicas_configurations[key] end @@ -69,7 +69,7 @@ def parse_knockoff_replica_envs_to_configs begin # Configure parameters such as prepared_statements, pool, reaping_frequency for all replicas. - to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.configuration_hash || {} + to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.to_h || {} register_replica_copy(index, env_key, to_copy) rescue URI::InvalidURIError