File tree Expand file tree Collapse file tree 7 files changed +56
-28
lines changed
Expand file tree Collapse file tree 7 files changed +56
-28
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
Original file line number Diff line number Diff line change @@ -30,16 +30,20 @@ if [ "$1" = 'postgres' ]; then
3030
3131 : ${POSTGRES_USER:= postgres}
3232 : ${POSTGRES_DB:= $POSTGRES_USER }
33- if [ " $POSTGRES_DB " = ' postgres' ]; then
34- op=' ALTER'
35- else
36- op=' CREATE'
33+
34+ if [ ! " $POSTGRES_DB " = ' postgres' ]; then
3735 gosu postgres postgres --single -jE << -EOSQL
3836 CREATE DATABASE "$POSTGRES_DB " ;
3937 EOSQL
4038 echo
4139 fi
4240
41+ if [ " $POSTGRES_USER " = ' postgres' ]; then
42+ op=' ALTER'
43+ else
44+ op=' CREATE'
45+ fi
46+
4347 gosu postgres postgres --single -jE << -EOSQL
4448 $op USER "$POSTGRES_USER " WITH SUPERUSER $pass ;
4549 EOSQL
You can’t perform that action at this time.
0 commit comments