Add a new environment variable RSD_ENVIRONMENT that when set to the value dev, allows the first user that logs in to become an admin. With any other value, this env variable does nothing.
Note: This is a feature for local development only and is therefore not safe in production. When two people login at the same time, they might both become admin for example.
How to test:
Add the new env variable to your .env and set its value to dev.
docker compose down --volumes && docker compose build --parallel && docker compose up
Log in in any way you like, you should be an admin. Repeatedly logging in and out with this account should not change this. Repeatedly logging in and out with other accounts should not make those admin.
Run DELETE FROM admin_account; in the database to delete all existing admins.
When you now log in with any account, that account should become admin.
Delete all admins again, change the value of RSD_ENVIRONMENT to anything other than dev and restart the RSD (or at least the auth service with docker compose up auth)
Logging in should not make you admin.
Closes #1062
PR Checklist:
[x] Increase version numbers in docker-compose.yml
Easily become admin when developing locally
Changes proposed in this pull request:
RSD_ENVIRONMENT
that when set to the valuedev
, allows the first user that logs in to become an admin. With any other value, this env variable does nothing.Note: This is a feature for local development only and is therefore not safe in production. When two people login at the same time, they might both become admin for example.
How to test:
.env
and set its value todev
.docker compose down --volumes && docker compose build --parallel && docker compose up
DELETE FROM admin_account;
in the database to delete all existing admins.RSD_ENVIRONMENT
to anything other thandev
and restart the RSD (or at least the auth service withdocker compose up auth
)Closes #1062
PR Checklist:
docker-compose.yml