[IMP] Allow PG* env vars to be set directly

Makes it possible to use a non-linked Postgres container without having
to fake $DB_* environment variables.
This commit is contained in:
Mike Dillon 2015-03-07 22:18:12 -08:00 committed by Samus CTO
parent 89454a4c41
commit 6a6ceb5b10

View File

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
set -e
# set odoo database host, port, user and password # set odoo database host, port, user and password
export PGHOST=$DB_PORT_5432_TCP_ADDR : ${PGHOST:=$DB_PORT_5432_TCP_ADDR}
export PGPORT=$DB_PORT_5432_TCP_PORT : ${PGPORT:=$DB_PORT_5432_TCP_PORT}
export PGUSER=$DB_ENV_POSTGRES_USER : ${PGUSER:=${DB_ENV_POSTGRES_USER:='postgres'}}
export PGPASSWORD=$DB_ENV_POSTGRES_PASSWORD : ${PGPASSWORD:=$DB_ENV_POSTGRES_PASSWORD}
export PGHOST PGPORT PGUSER PGPASSWORD
[ "$1" != "--" ] && exec "$@" [ "$1" != "--" ] && exec "$@"