Skip to content

Commit

Permalink
Revert "Add support for missing Postgres connection options (#54101)"
Browse files Browse the repository at this point in the history
This reverts commit 36a4a53.
  • Loading branch information
crynobone authored Jan 14, 2025
1 parent 04955c4 commit 7af4efb
Showing 1 changed file with 2 additions and 59 deletions.
61 changes: 2 additions & 59 deletions src/Illuminate/Database/Connectors/PostgresConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ protected function getDsn(array $config)
$dsn .= ";application_name='".str_replace("'", "\'", $application_name)."'";
}

$dsn = $this->addSslOptions($dsn, $config);

return $this->addPostgresOptions($dsn, $config);
return $this->addSslOptions($dsn, $config);
}

/**
Expand All @@ -164,62 +162,7 @@ protected function getDsn(array $config)
*/
protected function addSslOptions($dsn, array $config)
{
foreach ([
'sslmode',
'sslcert',
'sslkey',
'sslrootcert',
'requiressl',
'sslnegotiation',
'sslcompression',
'sslpassword',
'sslcertmode',
'sslcrl',
'sslcrldir',
'sslsni',
] as $option) {
if (isset($config[$option])) {
$dsn .= ";{$option}={$config[$option]}";
}
}

return $dsn;
}

/**
* Add Postgres specific options to the DSN.
*
* @param string $dsn
* @param array $config
* @return string
*/
protected function addPostgresOptions($dsn, array $config)
{
foreach ([
'channel_binding',
'connect_timeout',
'fallback_application_name',
'gssdelegation',
'gssencmode',
'gsslib',
'hostaddr',
'keepalives',
'keepalives_count',
'keepalives_idle',
'keepalives_interval',
'krbsrvname',
'load_balance_hosts',
'options',
'passfile',
'replication',
'require_auth',
'requirepeer',
'service',
'ssl_max_protocol_version',
'ssl_min_protocol_version',
'target_session_attrs',
'tcp_user_timeout',
] as $option) {
foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) {
if (isset($config[$option])) {
$dsn .= ";{$option}={$config[$option]}";
}
Expand Down

0 comments on commit 7af4efb

Please sign in to comment.