Skip to content

Commit

Permalink
Update Elastic.php
Browse files Browse the repository at this point in the history
  • Loading branch information
amirfaramarzi authored Jun 2, 2022
1 parent e25ada2 commit 7a29124
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Elastic.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ class Elastic

public static function setInstance()
{
self::$instance = (new ClientBuilder())
->setHosts([Loader::get('elastic')['host'] . ':' . Loader::get('elastic')['port']])
->setBasicAuthentication(Loader::get('elastic')['username'] , Loader::get('elastic')['password'])
->build();
$istance = (new ClientBuilder())->setHosts([Loader::get('elastic')['host'] . ':' . Loader::get('elastic')['port']]);

if (Loader::get('elastic')['username'] != null && Loader::get('elastic')['password'] != null){
$istance->setBasicAuthentication(Loader::get('elastic')['username'] , Loader::get('elastic')['password']);
}

self::$instance = $istance->build();
}

public static function getInstance(): Client
Expand Down

0 comments on commit 7a29124

Please sign in to comment.