From 6faaea6270c0e3a1c6093b526e0fa38bf124bed8 Mon Sep 17 00:00:00 2001 From: Chris Penny Date: Mon, 10 Jun 2024 10:30:28 +1200 Subject: [PATCH] Rename "public" to "query" --- .circleci/.env.circleci | 2 +- README.md | 2 +- _config/config.yml | 4 ++-- src/Service/ClientFactory.php | 4 ++-- tests/Service/ClientFactoryTest.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/.env.circleci b/.circleci/.env.circleci index 411bf66..b5632b6 100644 --- a/.circleci/.env.circleci +++ b/.circleci/.env.circleci @@ -10,4 +10,4 @@ SS_DEFAULT_ADMIN_PASSWORD=password SS_ERROR_LOG="silverstripe.log" BIFROST_ENDPOINT="http://localhost" BIFROST_ENGINE_PREFIX="search-dev-main" -BIFROST_PUBLIC_API_KEY="public-key" +BIFROST_QUERY_API_KEY="public-key" diff --git a/README.md b/README.md index 8552866..1ee6e03 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ The following environment variables are required for this module to function: * `BIFROST_ENDPOINT` * `BIFROST_ENGINE_PREFIX` -* `BIFROST_PUBLIC_API_KEY` +* `BIFROST_QUERY_API_KEY` ## Usage diff --git a/_config/config.yml b/_config/config.yml index 1c10eb4..9da3875 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,12 +1,12 @@ --- Name: discoverer-bifrost Only: - envvarset: 'BIFROST_PUBLIC_API_KEY' + envvarset: 'BIFROST_QUERY_API_KEY' --- SilverStripe\Core\Injector\Injector: Elastic\EnterpriseSearch\Client.searchClient: factory: SilverStripe\DiscovererBifrost\Service\ClientFactory constructor: host: '`BIFROST_ENDPOINT`' - token: '`BIFROST_PUBLIC_API_KEY`' + token: '`BIFROST_QUERY_API_KEY`' http_client: '%$GuzzleHttp\Client' diff --git a/src/Service/ClientFactory.php b/src/Service/ClientFactory.php index c4e3578..801bbd2 100644 --- a/src/Service/ClientFactory.php +++ b/src/Service/ClientFactory.php @@ -10,7 +10,7 @@ class ClientFactory implements Factory { private const ENDPOINT = 'BIFROST_ENDPOINT'; - private const PUBLIC_API_KEY = 'BIFROST_PUBLIC_API_KEY'; + private const QUERY_API_KEY = 'BIFROST_QUERY_API_KEY'; /** * @throws Exception @@ -28,7 +28,7 @@ public function create(mixed $service, array $params = []) // phpcs:ignore Slevo } if (!$token) { - $missingEnvVars[] = self::PUBLIC_API_KEY; + $missingEnvVars[] = self::QUERY_API_KEY; } if ($missingEnvVars) { diff --git a/tests/Service/ClientFactoryTest.php b/tests/Service/ClientFactoryTest.php index 7a3d8ef..384b51d 100644 --- a/tests/Service/ClientFactoryTest.php +++ b/tests/Service/ClientFactoryTest.php @@ -28,7 +28,7 @@ public function testCreate(): void public function testCreateMissingEnvVars(): void { - $this->expectExceptionMessage('Required ENV vars missing: BIFROST_ENDPOINT, BIFROST_PUBLIC_API_KEY'); + $this->expectExceptionMessage('Required ENV vars missing: BIFROST_ENDPOINT, BIFROST_QUERY_API_KEY'); $clientFactory = new ClientFactory(); // Expect this to throw our Exception as no params have been passed