Skip to content

Commit

Permalink
fix: sync script not using SSL
Browse files Browse the repository at this point in the history
Failed in production because SSL was not enabled for the MariaDB side. The
PostgreSQL side now also requires SSL.
  • Loading branch information
tomudding committed Oct 31, 2024
1 parent c3a94ef commit 65969f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion importdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

$pgconn = new PDO(
sprintf(
'pgsql:host=%s;port=%d;dbname=%s;options=\'--client_encoding=%s\'',
'pgsql:host=%s;port=%d;dbname=%s;sslmode=require;options=\'--client_encoding=%s\'',
$config['host'],
$config['port'],
$config['dbname'],
Expand Down Expand Up @@ -107,6 +107,8 @@
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $params['charset'] . ' COLLATE ' . $params['collate'],
PDO::MYSQL_ATTR_SSL_CAPATH => '/etc/ssl/certs/',
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true,
],
);
} catch (Exception|Error $e) {
Expand Down

0 comments on commit 65969f7

Please sign in to comment.