diff --git a/Connection.php b/Connection.php index 3927b91..ee16a5e 100644 --- a/Connection.php +++ b/Connection.php @@ -24,6 +24,13 @@ class Connection extends \yii\db\Connection */ public $commandClass = 'bashkarev\clickhouse\Command'; + /** + * Additional options you can pass to clickhouse client constructor + * + * @var array + */ + public $clientOptions = []; + /** * @var Client */ @@ -55,12 +62,12 @@ public function open() if ($this->_client === null) { $config = $this->parseDsn(); - $this->_client = new Client([ + $this->_client = new Client(array_merge([ 'host' => $config['host'] ?? '127.0.0.1', 'port' => $config['port'] ?? 8123, 'username' => $this->username, 'password' => $this->password, - ], + ], $this->clientOptions), array_merge([ 'database' => $config['database'] ?? 'default', ], $this->attributes ?? [])