aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-29 15:05:30 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-29 15:05:30 -0600
commit83e00c642b16b7b56d1e6a732b55be4a2e9997df (patch)
tree9f5dc7a31757cf82916a92a20401f104d8b84055 /activerecord
parenta25c2cbbec86a0f17b391cbe4414445e229044d9 (diff)
parent86a23faa1a82a3e7a2cdf2df01eb6eb18dd3d6f6 (diff)
downloadrails-83e00c642b16b7b56d1e6a732b55be4a2e9997df.tar.gz
rails-83e00c642b16b7b56d1e6a732b55be4a2e9997df.tar.bz2
rails-83e00c642b16b7b56d1e6a732b55be4a2e9997df.zip
Merge pull request #19511 from larskanis/replace_const_conn_params
PostgreSQL, Replace static connection param list by libpq's dynamic list
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 01746d8e14..787dadfdbf 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -19,12 +19,6 @@ require 'ipaddr'
module ActiveRecord
module ConnectionHandling # :nodoc:
- VALID_CONN_PARAMS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout,
- :client_encoding, :options, :application_name, :fallback_application_name,
- :keepalives, :keepalives_idle, :keepalives_interval, :keepalives_count,
- :tty, :sslmode, :requiressl, :sslcompression, :sslcert, :sslkey,
- :sslrootcert, :sslcrl, :requirepeer, :krbsrvname, :gsslib, :service]
-
# Establishes a connection to the database that's used by all Active Record objects
def postgresql_connection(config)
conn_params = config.symbolize_keys
@@ -36,7 +30,8 @@ module ActiveRecord
conn_params[:dbname] = conn_params.delete(:database) if conn_params[:database]
# Forward only valid config params to PGconn.connect.
- conn_params.keep_if { |k, _| VALID_CONN_PARAMS.include?(k) }
+ valid_conn_param_keys = PGconn.conndefaults_hash.keys + [:requiressl]
+ conn_params.slice!(*valid_conn_param_keys)
# The postgres drivers don't allow the creation of an unconnected PGconn object,
# so just pass a nil connection object for the time being.