lib/pghero/database.rb in pghero-3.4.1 vs lib/pghero/database.rb in pghero-3.6.0
- old
+ new
@@ -124,11 +124,11 @@
def connection_model
unless @adapter_checked
# rough check for Postgres adapter
# keep this message generic so it's useful
# when empty url set in Docker image pghero.yml
- unless @connection_model.connection.adapter_name =~ /postg/i
+ unless @connection_model.connection.adapter_name.match?(/postg/i)
raise Error, "Invalid connection URL"
end
@adapter_checked = true
end
@@ -143,10 +143,10 @@
# resolve spec
if !url && config["spec"]
config_options = {env_name: PgHero.env, PgHero.spec_name_key => config["spec"], PgHero.include_replicas_key => true}
resolved = ActiveRecord::Base.configurations.configs_for(**config_options)
raise Error, "Spec not found: #{config["spec"]}" unless resolved
- url = ActiveRecord::VERSION::STRING.to_f >= 6.1 ? resolved.configuration_hash : resolved.config
+ url = resolved.configuration_hash
end
url = url.dup
Class.new(PgHero::Connection) do