mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-06-27 21:22:02 +08:00
a1ca18b780
It's existence otherwise cause issues while replication users, as such the `configure_recovery` function is promoted higher in the initialization sequence.
39 lines
731 B
Bash
Executable File
39 lines
731 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
source ${PG_APP_HOME}/functions
|
|
|
|
# allow arguments to be passed to postgres
|
|
if [[ ${1:0:1} = '-' ]]; then
|
|
EXTRA_ARGS="$@"
|
|
set --
|
|
elif [[ ${1} == postgres || ${1} == $(which postgres) ]]; then
|
|
EXTRA_ARGS="${@:2}"
|
|
set --
|
|
fi
|
|
|
|
# default behaviour is to launch postgres
|
|
if [[ -z ${1} ]]; then
|
|
map_uidgid
|
|
|
|
create_datadir
|
|
create_certdir
|
|
create_logdir
|
|
create_rundir
|
|
|
|
initialize_database
|
|
configure_recovery
|
|
configure_ssl
|
|
trust_localnet
|
|
|
|
create_user
|
|
create_database
|
|
create_replication_user
|
|
|
|
echo "Starting PostgreSQL ${PG_VERSION}..."
|
|
exec start-stop-daemon --start --chuid ${PG_USER}:${PG_USER} \
|
|
--exec ${PG_BINDIR}/postgres -- -D ${PG_DATADIR} ${EXTRA_ARGS}
|
|
else
|
|
exec "$@"
|
|
fi
|
|
|