Skip to content

Commit

Permalink
Merge pull request #95 from City-of-Helsinki/tuutti-patch-1
Browse files Browse the repository at this point in the history
Update api-accounts.md
  • Loading branch information
tuutti authored Apr 19, 2023
2 parents df05cbc + e193d6b commit 644d77e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions documentation/api-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ This can be used to ensure that API users always retain the same credentials, i.

Define an environment variable called `DRUPAL_API_ACCOUNTS`. These accounts are read and mapped in [settings.php](https://github.com/City-of-Helsinki/drupal-helfi-platform/blob/main/public/sites/default/settings.php) file shipped with `City-of-Helsinki/drupal-helfi-platform`.

The value should be a JSON string that contains an array of `username`, `password` and an optional `roles` pairs:
The value should be a JSON string that contains an array of `username`, `password` and an optional `roles` and `mail` pairs:

```bash
DRUPAL_API_ACCOUNTS='[{"username":"account1","password":"password1","roles":["role1","role2"]},{"username":"account2","password":"password2"}]'
DRUPAL_API_ACCOUNTS='[{"username":"account1","password":"password1","roles":["role1","role2"]},{"username":"account2","password":"password2","mail":"some-email@example.com"}]'
```

If no `mail` is provided, an email address like `drupal+$username@hel.fi` is used. For example: `drupal+account1@hel.fi`.

We hook into `helfi_api_base.post_deploy` event ([src/EventSubscriber/EnsureApiAccountsSubscriber.php](/src/EventSubscriber/EnsureApiAccountsSubscriber.php)), triggered by `drush helfi:post-deploy` command executed as a part of deployment tasks: [https://github.com/City-of-Helsinki/drupal-helfi-platform/blob/main/docker/openshift/entrypoints/20-deploy.sh](https://github.com/City-of-Helsinki/drupal-helfi-platform/blob/main/docker/openshift/entrypoints/20-deploy.sh)

0 comments on commit 644d77e

Please sign in to comment.