Skip to content

Commit

Permalink
Add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Radomir98 committed Sep 3, 2024
1 parent b032a4b commit e8e5f3f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Findologic/Client/ServiceConfigClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ public function __construct(
private readonly string $shopkey,
private ?Client $client = null
) {
$this->client = $client ?? new Client(['base_uri' => BaseUrl::CDN]);
$this->initializeClient();
}

private function initializeClient(): void
{
if (!$this->client || $this->isBaseUriDifferent()) {
$this->client = new Client(['base_uri' => BaseUrl::CDN]);
}
}

private function isBaseUriDifferent(): bool
{
$currentBaseUri = $this->client->getConfig()['base_uri'] ?? null;
return $currentBaseUri !== BaseUrl::CDN;
}

/**
Expand Down

0 comments on commit e8e5f3f

Please sign in to comment.