Skip to content

Commit

Permalink
chore: allow DATABASE_URL env to take presedence over individual conn…
Browse files Browse the repository at this point in the history
…ection params. (#1147)

fixes: #1147 
Co-authored-by: Pranav Raj S <[email protected]>
  • Loading branch information
quacktacular and Pranav Raj S authored Sep 11, 2020
1 parent 31c0777 commit fe3cb76
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docker/entrypoints/rails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe3cb76

Please sign in to comment.