@@ -31,13 +31,18 @@ if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
POSTGRES_HOST_AUTH_METHOD="${POSTGRES_HOST_AUTH_METHOD:=$auth_method}"
|
||||
printf "\nhost all all all %s\n" "$POSTGRES_HOST_AUTH_METHOD" >> "$PGDATA/pg_hba.conf"
|
||||
|
||||
pg_ctl -w start
|
||||
pg_ctl -w start -o "-c config_file=/etc/postgresql/postgresql.conf"
|
||||
|
||||
if ! psql --username="$POSTGRES_USER" -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = '$POSTGRES_DB'" | grep -q 1; then
|
||||
psql --username="$POSTGRES_USER" -d postgres -c "CREATE DATABASE \"$POSTGRES_DB\";"
|
||||
fi
|
||||
|
||||
pg_ctl -m fast -w stop
|
||||
if [ -f /etc/postgresql/init.sh ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/postgresql/init.sh
|
||||
fi
|
||||
|
||||
pg_ctl -m fast -w stop -o "-c config_file=/etc/postgresql/postgresql.conf"
|
||||
fi
|
||||
|
||||
exec postgres -c config_file="/etc/postgresql/postgresql.conf" "$@" > "$LOG_PIPE" 2>&1
|
||||
|
Reference in New Issue
Block a user