Skip to content

Commit

Permalink
Add gssencmode option to connection string for PgSQL & PDO PgSQL driv…
Browse files Browse the repository at this point in the history
…er (#6320)

<!-- Fill in the relevant information below to help triage your pull
request. -->

|      Q       |   A
|------------- | -----------
| Type         | improvement
| Fixed issues | #6319 

#### Summary

This adds the `gssencmode` option for PostgreSQL connections for both
the PgSQL and PDO PgSQL driver.
  • Loading branch information
hacfi committed Mar 3, 2024
1 parent 00d8f60 commit b4329d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/en/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ pdo_pgsql / pgsql
- ``sslcrl`` (string): specifies the filename of the SSL certificate
revocation list (CRL).
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
- ``gssencmode`` (string): Optional GSS-encrypted channel/GSSEncMode configuration.
See `https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-GSSENCMODE`
- ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``.

Expand Down
4 changes: 4 additions & 0 deletions src/Driver/PDO/PgSQL/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ private function constructPdoDsn(array $params): string
$dsn .= 'application_name=' . $params['application_name'] . ';';
}

if (isset($params['gssencmode'])) {
$dsn .= 'gssencmode=' . $params['gssencmode'] . ';';
}

return $dsn;
}
}
1 change: 1 addition & 0 deletions src/Driver/PgSQL/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private function constructConnectionString(
'user' => $params['user'] ?? null,
'password' => $params['password'] ?? null,
'sslmode' => $params['sslmode'] ?? null,
'gssencmode' => $params['gssencmode'] ?? null,
],
static fn ($value) => $value !== '' && $value !== null,
);
Expand Down

0 comments on commit b4329d5

Please sign in to comment.