From cda0db0ad662c6d99b4e8d2f6af0a661359c1985 Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 16 May 2025 16:38:13 +0800 Subject: [PATCH] . --- docker-entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d095c7b..c8959f0 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -88,6 +88,17 @@ docker_init_database_dir() { set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@" fi + + + echo "[DEBUG] POSTGRES_USER=$POSTGRES_USER" >&2 + echo "[DEBUG] POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >&2 + echo "[DEBUG] POSTGRES_INITDB_ARGS=$POSTGRES_INITDB_ARGS" >&2 + echo "[DEBUG] \$@ = $@" >&2 + + # 实际拼接结果 + eval_str='initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s\n" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"' + echo "[DEBUG] eval command = $eval_str" >&2 + # --pwfile refuses to handle a properly-empty file (hence the "\n"): https://github.com/docker-library/postgres/issues/1025 eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s\n" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'