Skip to content

Commit 6aa6d9e

Browse files
authored
Merge pull request #21 from ensi-platform/task-105513-v7
#105513 v7 Исправление старого варианта авторизации через URL
2 parents 993ee87 + 0e79777 commit 6aa6d9e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/ElasticClient.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,15 @@ public function getQueryLog(): Collection
118118

119119
public static function fromConfig(array $config): static
120120
{
121-
$client = (new ClientBuilder())
121+
$builder = (new ClientBuilder())
122122
->setHosts($config['hosts'])
123-
->setBasicAuthentication($config['username'] ?? '', $config['password'] ?? '')
124123
->setRetries($config['retries'] ?? 1)
125-
->setSSLVerification($config['ssl_verification'] ?? false)
126-
->build();
124+
->setSSLVerification($config['ssl_verification'] ?? false);
127125

128-
return new static($client);
126+
if (filled($config['username'] ?? null)) {
127+
$builder->setBasicAuthentication($config['username'], $config['password'] ?? '');
128+
}
129+
130+
return new static($builder->build());
129131
}
130132
}

0 commit comments

Comments
 (0)