diff --git a/src/Checker/ElasticsearchChecker.php b/src/Checker/ElasticsearchChecker.php index 7e94b498..0e4c2981 100644 --- a/src/Checker/ElasticsearchChecker.php +++ b/src/Checker/ElasticsearchChecker.php @@ -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 { diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 5fa46664..ec4b9690 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -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: