pg_create_user: extracts more environment variables

This commit is contained in:
Luka Vandervelden 2019-10-26 15:44:35 +02:00
parent f53db2c6cc
commit 134da2dea4
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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