Fix: Use local host on db's healthcheck

hostname -i will malfunction in some cases like the `nsswitch.conf` file does'nt exist

Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
DQ 2021-04-16 18:37:24 +08:00
parent fb50b1313e
commit ffed6459c7

View File

@ -1,8 +1,7 @@
#!/bin/bash
set -eo pipefail
h="$(hostname -i || echo '127.0.0.1')"
host="${h%%[[:space:]]*}" #remove the trailing space
host="localhost"
user="${POSTGRES_USER:-postgres}"
db="${POSTGRES_DB:-$POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"