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 d2927af commit 9bd6577
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ doctrine:
options:
enable_http_compression: 1
max_execution_time: 60
sslCA: '/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt'
#mysql:
# ...
```
Expand Down
24 changes: 15 additions & 9 deletions src/ClickHouseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,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 9bd6577

Please sign in to comment.