Skip to content

Commit

Permalink
Fix pg_basebackup not receiving password prompt properly. (DanielDent#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrouesnel authored and DanielDent committed Nov 16, 2016
1 parent c057166 commit a854a92
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ if [ "x$PGUSER" != "x" ]; then
fi
if [ "x$PGPASSWORD" != "x" ]; then
POSTGRES_PASSWORD=$PGPASSWORD
fi
fi

# Forwards-compatibility for old variable names (pg_basebackup uses them)
if [ "x$PGPASSWORD" = "x" ]; then
export PGPASSWORD=$POSTGRES_PASSWORD
fi

# Based on official postgres package's entrypoint script (https://hub.docker.com/_/postgres/)
# Modified to be able to set up a slave. The docker-entrypoint-initdb.d hook provided is inadequate.
Expand Down Expand Up @@ -36,7 +41,7 @@ if [ "$1" = 'postgres' ]; then
echo "Waiting for master to ping..."
sleep 1s
done
until gosu postgres pg_basebackup -h ${REPLICATE_FROM} -D ${PGDATA} -U ${POSTGRES_USER} -vP
until gosu postgres pg_basebackup -h ${REPLICATE_FROM} -D ${PGDATA} -U ${POSTGRES_USER} -vP -w
do
echo "Waiting for master to connect..."
sleep 1s
Expand Down

0 comments on commit a854a92

Please sign in to comment.