Skip to content

Commit e0f39db

Browse files
committed
connector upgrade
1 parent 3629d4f commit e0f39db

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/Connection.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class Connection extends BaseConnection
1717
protected $index;
1818
protected $maxSize;
1919
protected $indexPrefix;
20-
protected $retires = null; //null will use default
20+
protected $allowIdSort = false;
2121
protected $sslVerification = true;
22-
protected $elasticMetaHeader = true;
22+
protected $retires = null; //null will use default
23+
protected $elasticMetaHeader = null;
2324
protected $rebuild = false;
24-
protected $allowIdSort = false;
2525

2626
public function __construct(array $config)
2727
{
@@ -44,16 +44,16 @@ public function setOptions($config)
4444
if (!empty($config['index_prefix'])) {
4545
$this->indexPrefix = $config['index_prefix'];
4646
}
47-
if (!empty($config['options']['allow_id_sort'])) {
47+
if (isset($config['options']['allow_id_sort'])) {
4848
$this->allowIdSort = $config['options']['allow_id_sort'];
4949
}
50-
if (!empty($config['options']['ssl_verification'])) {
50+
if (isset($config['options']['ssl_verification'])) {
5151
$this->sslVerification = $config['options']['ssl_verification'];
5252
}
53-
if (!empty($config['options']['retires'])) {
53+
if (isset($config['options']['retires'])) {
5454
$this->retires = $config['options']['retires'];
5555
}
56-
if (!empty($config['options']['meta_header'])) {
56+
if (isset($config['options']['meta_header'])) {
5757
$this->elasticMetaHeader = $config['options']['meta_header'];
5858
}
5959
}
@@ -239,8 +239,11 @@ protected function _cloudConnection(): Client
239239
protected function _builderOptions($cb)
240240
{
241241
$cb->setSSLVerification($this->sslVerification);
242-
$cb->setElasticMetaHeader($this->elasticMetaHeader);
243-
if ($this->retires) {
242+
if (isset($this->elasticMetaHeader)) {
243+
$cb->setElasticMetaHeader($this->elasticMetaHeader);
244+
}
245+
246+
if (isset($this->retires)) {
244247
$cb->setRetries($this->retires);
245248
}
246249
$caBundle = config('database.connections.elasticsearch.ssl_cert') ?? null;

0 commit comments

Comments
 (0)