diff --git a/services/gitea.spec b/services/gitea.spec index 80e24a2..858882d 100644 --- a/services/gitea.spec +++ b/services/gitea.spec @@ -10,4 +10,4 @@ consumes: postgresql name: gitea database creation # 'command' is run only if this directory doesn't exist unless-file: ${SERVICE_ROOT}/db_is_setup - command: pg_create_user.sh --pghost=localhost --pgport=$(get-port $POSTGRESQL_PROVIDER) --pgdatadir=$POSTGRESQL_ROOT --pguser=postgres --dbuser=${ENVIRONMENT}_gitea --dbpassfile=${SERVICE_ROOT}/password_main --dbname=${ENVIRONMENT}_gitea_db create_user_and_db && touch ${SERVICE_ROOT}/db_is_setup + command: pg_create_user.sh create_user_and_db && touch ${SERVICE_ROOT}/db_is_setup diff --git a/utils/pg_create_user.sh b/utils/pg_create_user.sh index 2ee003c..0f6986b 100755 --- a/utils/pg_create_user.sh +++ b/utils/pg_create_user.sh @@ -4,8 +4,12 @@ : ${PGUSER:=postgres} # TODO: add default postgresql port -: ${pgport} -: ${dbname} +: ${pgport:=$(get-port $POSTGRESQL_PROVIDER)} + +: ${PGDATA:=$POSTGRESQL_ROOT} +: ${dbuser:=${SERVICE_ID//\//_}} +: ${dbpassfile:=${SERVICE_ROOT+$SERVICE_ROOT/password_main}} +: ${dbname:=${SERVICE_ID+${SERVICE_ID//\//_}_db}} : ${command} : ${cmdparameters} @@ -124,6 +128,8 @@ then exit 1 fi +export PGDATA PGHOST PGUSER + if [ -z $simulation ] then case ${command} in