Skip to content

Commit

Permalink
Set the host_auth_method during initdb
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed May 31, 2023
1 parent b4ed8fa commit a18c60a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bci_build/postgres/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi

[ -z "$POSTGRES_HOST_AUTH_METHOD" ] || AUTH_ARGS="--auth=${POSTGRES_HOST_AUTH_METHOD}"

# --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") $AUTH_ARGS '"$POSTGRES_INITDB_ARGS"' "$@"'

# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
Expand Down

0 comments on commit a18c60a

Please sign in to comment.