28 lines
503 B
Bash
Executable file
28 lines
503 B
Bash
Executable file
#!/bin/bash
|
|
|
|
export ENABLE_REPLICATION=${ENABLE_REPLICATION:-false}
|
|
|
|
set -eu
|
|
export_vars=$(cgroup-limits) ; export $export_vars
|
|
|
|
source "${CONTAINER_SCRIPTS_PATH}/common.sh"
|
|
|
|
set_pgdata
|
|
check_env_vars
|
|
generate_passwd_file
|
|
generate_postgresql_config
|
|
|
|
if [ ! -f "$PGDATA/postgresql.conf" ]; then
|
|
initialize_database
|
|
NEED_TO_CREATE_USERS=yes
|
|
fi
|
|
|
|
pg_ctl -w start -o "-h ''"
|
|
if [ "${NEED_TO_CREATE_USERS:-}" == "yes" ]; then
|
|
create_users
|
|
fi
|
|
set_passwords
|
|
pg_ctl stop
|
|
|
|
unset_env_vars
|
|
exec postgres "$@"
|