Format container configs
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -24,11 +24,14 @@ mkfifo "$LOG_PIPE"
|
||||
LOG_PID=$!
|
||||
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s\n" "$POSTGRES_PASSWORD")
|
||||
tmpfile=$(mktemp)
|
||||
printf "%s\n" "$POSTGRES_PASSWORD" > "$tmpfile"
|
||||
initdb --username="$POSTGRES_USER" --pwfile="$tmpfile"
|
||||
rm -f "$tmpfile"
|
||||
|
||||
auth_method=$(postgres -c config_file="/etc/postgresql/postgresql.conf" -C password_encryption)
|
||||
POSTGRES_HOST_AUTH_METHOD="${POSTGRES_HOST_AUTH_METHOD:=$auth_method}"
|
||||
echo -e "\nhost all all all $POSTGRES_HOST_AUTH_METHOD" >> "$PGDATA/pg_hba.conf"
|
||||
printf "\nhost all all all %s\n" "$POSTGRES_HOST_AUTH_METHOD" >> "$PGDATA/pg_hba.conf"
|
||||
|
||||
pg_ctl -w start
|
||||
|
||||
@@ -39,5 +42,5 @@ if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
pg_ctl -m fast -w stop
|
||||
fi
|
||||
|
||||
trap "kill $LOG_PID" EXIT
|
||||
trap 'kill $LOG_PID' EXIT
|
||||
exec postgres -c config_file="/etc/postgresql/postgresql.conf" "$@" > "$LOG_PIPE" 2>&1
|
||||
|
Reference in New Issue
Block a user