Skip to content

Commit

Permalink
fix: add url in checker to avoid error couldn’t resolve host
Browse files Browse the repository at this point in the history
  • Loading branch information
delyriand committed Aug 30, 2023
1 parent 1930ec3 commit f679d3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Checker/ElasticsearchChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
class ElasticsearchChecker implements ElasticsearchCheckerInterface
{
private ?bool $isAvailable = null;
private array $config;

public function __construct(array $config = [])
{
$this->config = $config;
}

public function check(): bool
{
if (null === $this->isAvailable) {
$client = (new Factory())->buildClient();
$client = (new Factory($this->config))->buildClient();

// Check client response
try {
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ services:

monsieurbiz.search.checker.elasticsearch_checker:
class: MonsieurBiz\SyliusSearchPlugin\Checker\ElasticsearchChecker
arguments:
$config:
url: '%monsieurbiz_search_elasticsearch_url%'

MonsieurBiz\SyliusSearchPlugin\Twig\Extension\RenderSearchForm:
arguments:
Expand Down

0 comments on commit f679d3e

Please sign in to comment.