From ce8b39181b3f8d196bc731f0f4a243a0e734ace1 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Mon, 14 Jun 2021 16:17:44 -0400 Subject: [PATCH] make probe-readiness.sh use variables for DB_USER and DB_NAME --- probe-readiness.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/probe-readiness.sh b/probe-readiness.sh index f5326d6..fa00c5e 100755 --- a/probe-readiness.sh +++ b/probe-readiness.sh @@ -1,5 +1,12 @@ #!/bin/bash -PGPASSWORD="$DB_PASSWORD" /usr/pgsql-13/bin/psql -h localhost -p 5432 -U postgres -c "select 1 as psql_is_ready" 2>/dev/null | grep "psql_is_ready" +# Note: host and port should remain localhost and 5432 because +# those represent the location of pgbouncer itself, not the +# remote psql server that would have $DB_HOST:$DB_PORT. + +PGPASSWORD="$DB_PASSWORD" /usr/pgsql-13/bin/psql \ + -h localhost -p 5432 -U "${DB_USER}" -d "${DB_NAME}" \ + -c "select 1 as psql_is_ready" 2>/dev/null \ + | grep "psql_is_ready" exit $?