Skip to content

Commit a854a92

Browse files
wrouesnelDanielDent
authored andcommitted
Fix pg_basebackup not receiving password prompt properly. (#4)
1 parent c057166 commit a854a92

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docker-entrypoint.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ if [ "x$PGUSER" != "x" ]; then
66
fi
77
if [ "x$PGPASSWORD" != "x" ]; then
88
POSTGRES_PASSWORD=$PGPASSWORD
9-
fi
9+
fi
10+
11+
# Forwards-compatibility for old variable names (pg_basebackup uses them)
12+
if [ "x$PGPASSWORD" = "x" ]; then
13+
export PGPASSWORD=$POSTGRES_PASSWORD
14+
fi
1015

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

0 commit comments

Comments
 (0)