Skip to content

Commit

Permalink
UHF-8525: Renamed pubsub access_token setting to access_key to match …
Browse files Browse the repository at this point in the history
…the actual name
  • Loading branch information
tuutti committed Aug 31, 2023
1 parent 917de45 commit 284620a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config/schema/helfi_api_base.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ helfi_api_base.pubsub.settings:
mapping:
endpoint:
type: string
access_token:
access_key:
type: string
hub:
type: string
Expand Down
4 changes: 2 additions & 2 deletions documentation/pubsub-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Provides an integration to [Azure's Web PubSub service](https://azure.microsoft.
You must define the following settings to use this feature:

```php
$config['helfi_api_base.pubsub.settings']['access_token'] = '<access-token>';
$config['helfi_api_base.pubsub.settings']['access_key'] = '<access-key>';
// Url to Azure's wss endpoint, usually something like: yourservicename.webpubsub.azure.com
$config['helfi_api_base.pubsub.settings']['endpoint'] = '<url to azure pubsub endpoint>';
// Hub and group must be same in all instances that talk with each other.
Expand Down Expand Up @@ -82,7 +82,7 @@ See [CacheTagInvalidatorSubscriber](/src/EventSubscriber/CacheTagInvalidatorSubs

```php
# public/sites/default/local.settings.php
$config['helfi_api_base.pubsub.settings']['access_token'] = '<access-token>';
$config['helfi_api_base.pubsub.settings']['access_key'] = '<access-key>';
$config['helfi_api_base.pubsub.settings']['endpoint'] = '<url to azure pubsub endpoint>';
$config['helfi_api_base.pubsub.settings']['hub'] = '<hub>';
$config['helfi_api_base.pubsub.settings']['group'] = '<group>';
Expand Down
2 changes: 1 addition & 1 deletion src/Azure/PubSub/PubSubClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function create(Settings $settings, TimeInterface $time) : Client {
'webpubsub.sendToGroup',
'webpubsub.joinLeaveGroup',
],
], $settings->accessToken, 'HS256');
], $settings->accessKey, 'HS256');

return new Client($url, [
'headers' => [
Expand Down
4 changes: 2 additions & 2 deletions src/Azure/PubSub/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ final class Settings {
* The group.
* @param string $endpoint
* The API endpoint.
* @param string $accessToken
* @param string $accessKey
* The API access token.
*/
public function __construct(
public readonly string $hub,
public readonly string $group,
public readonly string $endpoint,
public readonly string $accessToken,
public readonly string $accessKey,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/Cache/CacheTagInvalidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function setUp() : void {
->set('endpoint', 'wss://localhost')
->set('hub', 'hub')
->set('group', 'group')
->set('access_token', '123')
->set('access_key', '123')
->save();
}

Expand Down
10 changes: 5 additions & 5 deletions tests/src/Unit/Azure/PubSub/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testSettings(array $values, array $expectedValues) : void {
$this->assertSame($settings->hub, $expectedValues['hub']);
$this->assertSame($settings->group, $expectedValues['group']);
$this->assertSame($settings->endpoint, $expectedValues['endpoint']);
$this->assertSame($settings->accessToken, $expectedValues['access_token']);
$this->assertSame($settings->accessKey, $expectedValues['access_key']);
}

/**
Expand All @@ -46,13 +46,13 @@ public function settingsData() : array {
'hub' => 'hub',
'group' => 'group',
'endpoint' => 'endpoint',
'access_token' => 'access_token',
'access_key' => 'access_key',
],
[
'hub' => 'hub',
'group' => 'group',
'endpoint' => 'endpoint',
'access_token' => 'access_token',
'access_key' => 'access_key',
],
],
];
Expand All @@ -63,13 +63,13 @@ public function settingsData() : array {
'hub' => $value,
'group' => $value,
'endpoint' => $value,
'access_token' => $value,
'access_key' => $value,
],
[
'hub' => '',
'group' => '',
'endpoint' => '',
'access_token' => '',
'access_key' => '',
],
];
}
Expand Down

0 comments on commit 284620a

Please sign in to comment.