# HG changeset patch # User Sascha Wilde # Date 1533297143 -7200 # Node ID a85f56207d804743a3165811067fc93424364347 # Parent fd04bccae6caba18449f973929c5cd77a54833ba db-setup script: Allow to set passwords manually. Especially during testing, when setting up a fresh db it is desirable to set the passwords to well known values instead of getting fresh random ones. This is now possible. diff -r fd04bccae6ca -r a85f56207d80 schema/install-db.sh --- a/schema/install-db.sh Fri Aug 03 13:40:10 2018 +0200 +++ b/schema/install-db.sh Fri Aug 03 13:52:23 2018 +0200 @@ -15,6 +15,10 @@ -p, --port=PORT connect do the postgresql cluster at PORT. Default is the postgresql standard port 5432 -D, --demo also install demo accounts and data + --adminpw set the password to use for the "sysadmin" account. + Default is a random password. + --servicepw set the password to use for the "gemma_service" account. + Default is a random password. --drop drop database and all roles --help display this help and exit @@ -40,11 +44,13 @@ port=5432 demo=0 drop=0 +adminpw=`genpw 15` +servicepw=`genpw 15` # Parse options: OPTS=`getopt \ - -l help,demo,db:,port:,drop \ + -l help,demo,db:,port:,drop,adminpw:,servicepw: \ -o Dd:p: -n "$ME" -- "$@"` [ $? -eq 0 ] || { usage ; exit 1 ; } @@ -60,6 +66,14 @@ port="$2" shift 2 ;; + --adminpw) + adminpw="$2" + shift 2 + ;; + --servicepw) + servicepw="$2" + shift 2 + ;; --demo|-D) demo=1 shift 1 @@ -98,11 +112,7 @@ psql -q -p "$port" -f "$BASEDIR/demo-data/roles.sql" \ -f "$BASEDIR/demo-data/users.sql" -d "$db" fi - - # Generate and set Passwords - adminpw=`genpw 15` - servicepw=`genpw 15` - + # set passwords: psql -qt -p "$port" -d "$db" \ -c "ALTER ROLE sysadmin PASSWORD '$adminpw'" psql -qt -p "$port" -d "$db" \