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
: ${POSTGRES_USER:=postgres}
if [ "$POSTGRES_USER" = 'postgres' ]; then
: ${POSTGRES_DB:=$POSTGRES_USER}
if [ "$POSTGRES_DB" = 'postgres' ]; then
op='ALTER'
else
op='CREATE'
gosu postgres postgres --single -jE <<-EOSQL
CREATE DATABASE "$POSTGRES_USER" ;
CREATE DATABASE "$POSTGRES_DB" ;
EOSQL
echo
fi

View File

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

View File

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

View File

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

View File

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

View File

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