Skip to content

Commit

Permalink
Add tokenCacheDir to the firebase options (#192)
Browse files Browse the repository at this point in the history
* Add tokenCacheDir to the firebase options

* Fix phpstan type issue

* Added tokenCacheDir to .dist
  • Loading branch information
parijke authored Jun 13, 2024
1 parent f7e787c commit 89419af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
15 changes: 0 additions & 15 deletions ci/qa/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,6 @@ parameters:
count: 2
path: ../../src/Tiqr/Legacy/TiqrService.php

-
message: "#^Cannot access offset 'projectId' on mixed\\.$#"
count: 1
path: ../../src/Tiqr/TiqrConfiguration.php

-
message: "#^Cannot access offset 'credentialsFile' on mixed\\.$#"
count: 1
path: ../../src/Tiqr/TiqrConfiguration.php

-
message: "#^Cannot access offset 'cacheTokens' on mixed\\.$#"
count: 1
path: ../../src/Tiqr/TiqrConfiguration.php

-
message: "#^Cannot access offset 'arguments' on mixed\\.$#"
count: 4
Expand Down
1 change: 1 addition & 0 deletions config/openconext/parameters.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ parameters:
projectId: 'FCM project ID'
credentialsFile: 'absolute path to file with service account key'
cacheTokens: false
tokenCacheDir: '/tmp'
accountblocking:
maxAttempts: 5
storage:
Expand Down
4 changes: 3 additions & 1 deletion src/Tiqr/TiqrConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ public function __construct(array $tiqrConfiguration)
$this->options['apns.environment'] = $tiqrConfiguration['library']['apns']['environment'];
}

if (isset($tiqrConfiguration['library']['firebase'])) {
if (isset($tiqrConfiguration['library']['firebase']) && is_array($tiqrConfiguration['library']['firebase'])) {
Assertion::string($tiqrConfiguration['library']['firebase']['projectId']);
$this->options['firebase.projectId'] = $tiqrConfiguration['library']['firebase']['projectId'];
Assertion::string($tiqrConfiguration['library']['firebase']['credentialsFile']);
$this->options['firebase.credentialsFile'] = $tiqrConfiguration['library']['firebase']['credentialsFile'];
Assertion::boolean($tiqrConfiguration['library']['firebase']['cacheTokens']);
$this->options['firebase.cacheTokens'] = $tiqrConfiguration['library']['firebase']['cacheTokens'];
Assertion::string($tiqrConfiguration['library']['firebase']['tokenCacheDir']);
$this->options['firebase.tokenCacheDir'] = $tiqrConfiguration['library']['firebase']['tokenCacheDir'];
}

if (isset($tiqrConfiguration['accountblocking'][self::MAX_ATTEMPTS])) {
Expand Down

0 comments on commit 89419af

Please sign in to comment.