Skip to content

Commit

Permalink
Add SSL options for Postgres DSN (#15371)
Browse files Browse the repository at this point in the history
* Add SSL options for Postgres DSN

There is already the SSLMODE option available, but if you set it to verify-full, you would need to also set the sslrootcert with the full path of the server certificate. This way, the client will be able to check the certificate of the server and be sure it's connecting to the right one.

This patch is only adding the different SSL option available for a postgres connection has stated here: https://www.postgresql.org/docs/9.5/static/libpq-connect.html

* Fix Style-Ci
  • Loading branch information
Belphemur authored and taylorotwell committed Sep 9, 2016
1 parent eeebfcc commit 3130be9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Illuminate/Database/Connectors/PostgresConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ protected function getDsn(array $config)
$dsn .= ";sslmode={$sslmode}";
}

if (isset($config['sslcert'])) {
$dsn .= ";sslcert={$sslcert}";
}

if (isset($config['sslkey'])) {
$dsn .= ";sslkey={$sslkey}";
}

if (isset($config['sslrootcert'])) {
$dsn .= ";sslrootcert={$sslrootcert}";
}

return $dsn;
}

Expand Down

0 comments on commit 3130be9

Please sign in to comment.