Added POSTGRES_DB variable to optionally specify DB name

This commit is contained in:
Justin Garrison 2015-02-12 16:07:53 -08:00
parent baf80692b5
commit 8e22601253
6 changed files with 17 additions and 11 deletions

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then : ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then : ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
: ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_USER" = 'postgres' ]; then if [ "$POSTGRES_USER" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then : ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then : ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi

View File

@ -29,12 +29,13 @@ if [ "$1" = 'postgres' ]; then
fi fi
: ${POSTGRES_USER:=postgres} : ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then : ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER' op='ALTER'
else else
op='CREATE' op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ; CREATE DATABASE "$POSTGRES_DB" ;
EOSQL EOSQL
echo echo
fi fi