Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-8525: Renamed pubsub access_token setting to access_key to match the actual name #124

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 src/Azure/PubSub/SettingsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function create() : Settings {
$config->get('hub') ?: '',
$config->get('group') ?: '',
$config->get('endpoint') ?: '',
$config->get('access_token') ?: '',
$config->get('access_key') ?: '',
);
}

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