Skip to content

Commit

Permalink
Rename "public" to "query"
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispenny committed Jun 9, 2024
1 parent c64e55c commit 6faaea6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .circleci/.env.circleci
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions src/Service/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/ClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6faaea6

Please sign in to comment.