This commit is contained in:
parent
46e92f1473
commit
98ec90a34c
|
|
@ -88,17 +88,6 @@ docker_init_database_dir() {
|
||||||
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
|
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
|
||||||
fi
|
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
|
# --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"' "$@"'
|
eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s\n" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
|
||||||
|
|
||||||
|
|
@ -341,7 +330,7 @@ _main() {
|
||||||
docker_init_database_dir
|
docker_init_database_dir
|
||||||
|
|
||||||
sed -i "s/^#*\s*listen_addresses\s*=.*/listen_addresses = '0.0.0.0'/" "$PGDATA"/postgresql.conf
|
sed -i "s/^#*\s*listen_addresses\s*=.*/listen_addresses = '0.0.0.0'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
pg_setup_hba_conf "$@"
|
pg_setup_hba_conf "$@"
|
||||||
|
|
||||||
# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
|
# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue