diff schema/install-db.sh @ 463:5611cf72cc92

Add metamorphic database role and user e.g. for GeoServer
author Tom Gottfried <tom@intevation.de>
date Wed, 22 Aug 2018 16:48:56 +0200
parents 8feb64128c34
children ab07eb290fa3
line wrap: on
line diff
--- a/schema/install-db.sh	Wed Aug 22 16:20:09 2018 +0200
+++ b/schema/install-db.sh	Wed Aug 22 16:48:56 2018 +0200
@@ -19,6 +19,8 @@
                    Default is a random password.
       --servicepw  set the password to use for the "gemma_service" account.
                    Default is a random password.
+      --metapw     set the password to use for the "meta_login" account.
+                   Default is a random password.
       --drop       drop database and all roles
       --help       display this help and exit
 
@@ -46,11 +48,12 @@
 drop=0
 adminpw=`genpw 15`
 servicepw=`genpw 15`
+metapw=`genpw 15`
 
 # Parse options:
 
 OPTS=`getopt \
-      -l help,demo,db:,port:,drop,adminpw:,servicepw: \
+      -l help,demo,db:,port:,drop,adminpw:,servicepw:,metapw: \
       -o Dd:p: -n "$ME" -- "$@"`
 [ $? -eq 0 ] || { usage ; exit 1 ; }
 
@@ -74,6 +77,10 @@
       servicepw="$2"
       shift 2
       ;;
+    --metapw)
+      metapw="$2"
+      shift 2
+      ;;
     --demo|-D)
       demo=1
       shift 1
@@ -120,8 +127,11 @@
        -c "ALTER ROLE sysadmin PASSWORD '$adminpw'"
   psql -qt -p "$port" -d "$db" \
        -c "ALTER ROLE gemma_service PASSWORD '$servicepw'"
+  psql -qt -p "$port" -d "$db" \
+       -c "ALTER ROLE meta_login PASSWORD '$metapw'"
   echo "Default admin user 'sysadmin' created with password '$adminpw'."
   echo "Back end user 'gemma_service' created with password '$servicepw'."
+  echo "Back end user 'meta_login' created with password '$metapw'."
 else
   # Evil mode: drop everything gemma
   echo "Really drop database '$db' and all gemma roles? [type 'yes']: "