diff --git a/src/ClickHouseConnection.php b/src/ClickHouseConnection.php index d138600..5c83bd9 100644 --- a/src/ClickHouseConnection.php +++ b/src/ClickHouseConnection.php @@ -38,15 +38,21 @@ public function __construct( string $password, AbstractPlatform $platform ) { - $this->client = new Client( - [ - 'host' => $params['host'] ?? 'localhost', - 'port' => $params['port'] ?? 8123, - 'username' => $user, - 'password' => $password, - ], - array_merge(['database' => $params['dbname'] ?? 'default'], $params['driverOptions'] ?? []) - ); + $connectParams = [ + 'host' => $params['host'] ?? 'localhost', + 'port' => $params['port'] ?? 8123, + 'username' => $user, + 'password' => $password, + ]; + + if (isset($params['driverOptions']['sslCA'])) { + $connectParams['sslCA'] = $params['driverOptions']['sslCA']; + unset($params['driverOptions']['sslCA']); + } + + $clientParams = array_merge(['database' => $params['dbname'] ?? 'default'], $params['driverOptions'] ?? []); + + $this->client = new Client($connectParams, $clientParams); $this->platform = $platform; }