Skip to content

Commit

Permalink
add ClientBuilder->setConnectionParams() (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliboy50 authored and polyfractal committed Dec 16, 2016
1 parent 30baa0d commit 3923432
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Elasticsearch/ClientBuilder.php
Expand Up @@ -71,6 +71,9 @@ class ClientBuilder
/** @var array */
private $hosts;

/** @var array */
private $connectionParams;

/** @var int */
private $retries;

Expand Down Expand Up @@ -312,6 +315,17 @@ public function setHosts($hosts)
return $this;
}

/**
* @param array $params
* @return $this
*/
public function setConnectionParams(array $params)
{
$this->connectionParams = $params;

return $this;
}

/**
* @param int $retries
* @return $this
Expand Down Expand Up @@ -425,8 +439,10 @@ public function build()
}

if (is_null($this->connectionFactory)) {
$connectionParams = [];
$this->connectionFactory = new ConnectionFactory($this->handler, $connectionParams, $this->serializer, $this->logger, $this->tracer);
if (is_null($this->connectionParams)) {
$this->connectionParams = [];
}
$this->connectionFactory = new ConnectionFactory($this->handler, $this->connectionParams, $this->serializer, $this->logger, $this->tracer);
}

if (is_null($this->hosts)) {
Expand Down

0 comments on commit 3923432

Please sign in to comment.