From f2c9d14edd12bfbb7e8f24065b658faec775b85d Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Tue, 14 Jun 2022 11:45:56 +0100 Subject: [PATCH 1/3] Let the make_superuser script target other databases #2712 --- dev/make_superuser.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/make_superuser.sh b/dev/make_superuser.sh index 88f77e3bb..bbea30550 100755 --- a/dev/make_superuser.sh +++ b/dev/make_superuser.sh @@ -6,6 +6,9 @@ set -e pushd `pwd` # We have to run docker-compose from this directory for it to pick up the .env file. cd `dirname "$0"` -docker-compose -f docker-compose.yml -f docker-compose.dev.yml exec mongo mongo covid19 --eval "var email='$1'; var roles=['admin', 'curator'];" /verification/scripts/roles.js + +# Tell us what database to use — default is covid19 but you can override it for other instances +DB="${GDH_DATABASE:-covid19}" +docker-compose -f docker-compose.yml -f docker-compose.dev.yml exec mongo mongo "${DB}" --eval "var email='$1'; var roles=['admin', 'curator'];" /verification/scripts/roles.js # Restore directory. popd \ No newline at end of file From eaeffd929d1e6be899b07cc09c34fc3b5af1595e Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Tue, 14 Jun 2022 11:51:39 +0100 Subject: [PATCH 2/3] Allow the setup_db script to run against different (local-only) databases #2712 --- dev/setup_db.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/setup_db.sh b/dev/setup_db.sh index 4eb6b90ca..61079f280 100755 --- a/dev/setup_db.sh +++ b/dev/setup_db.sh @@ -1,7 +1,6 @@ #!/bin/bash -export CONN="mongodb://localhost/covid19" -export DB="covid19" +export DB="${DB:-covid19}" npm --prefix=`dirname "$0"`/../data-serving/scripts/setup-db/ run-script migrate npm --prefix=`dirname "$0"`/../data-serving/scripts/setup-db/ run-script delete-all-cases From c5db6bc66b243be3ab89164a6af8ba7f99eb1d00 Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Tue, 14 Jun 2022 11:55:21 +0100 Subject: [PATCH 3/3] Update developer documentation #2712 --- dev/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/README.md b/dev/README.md index 48c1c2b20..ab9becdf7 100644 --- a/dev/README.md +++ b/dev/README.md @@ -69,7 +69,7 @@ Give your user all the permissions to access the portal and make CRUD updates. ./dev/make_superuser.sh $YOUR_GOOGLE_EMAIL ``` -Note that **the user must be logged-in into the portal before you can issue this command**. +Note that **the user must be logged-in into the portal before you can issue this command**. To run it against a different instance/database, set `$GDH_DATABASE` to the appropriate connection string. **Windows users**