chore: allow DATABASE_URL env to take presedence over individual connection params. (#1147)

fixes: #1147 
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
quacktacular 2020-09-11 02:02:24 -07:00 committed by GitHub
parent 31c07771e8
commit fe3cb76a19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,14 @@ rm -rf /app/tmp/cache/*
echo "Waiting for postgres to become ready...."
PGPASSWORD=$POSTGRES_PASSWORD
PSQL="pg_isready -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USERNAME"
# Let DATABASE_URL env take presedence over individual connection params.
if [ -z "$DATABASE_URL" ]; then
PGPASSWORD=$POSTGRES_PASSWORD
PSQL="pg_isready -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USERNAME"
else
PSQL="pg_isready -d $DATABASE_URL"
fi
until $PSQL
do
sleep 2;