Skip to content

Commit

Permalink
Add sslCA connection option
Browse files Browse the repository at this point in the history
  • Loading branch information
asanikovich committed Sep 26, 2024
1 parent 57c4676 commit 3b829d0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/ClickHouseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3b829d0

Please sign in to comment.