@@ -61,7 +61,7 @@ docker_create_db_directories() {
61
61
}
62
62
63
63
# initialize empty PGDATA directory with new database via 'initdb'
64
- # arguments to `initdb` can be passed via IVORYSQL_INITDB_ARGS or as arguments to this function
64
+ # arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function
65
65
# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames
66
66
# this is also where the database user is created, specified by `IVORYSQL_USER` env
67
67
docker_init_database_dir () {
@@ -89,9 +89,11 @@ docker_init_database_dir() {
89
89
fi
90
90
91
91
# --pwfile refuses to handle a properly-empty file (hence the "\n"): https://github.com/docker-library/postgres/issues/1025
92
- eval ' initdb --username="$IVORYSQL_USER" --pwfile=<(printf "%s\n" "$IVORYSQL_PASSWORD") ' " $IVORYSQL_INITDB_ARGS " ' "$@"'
92
+ eval ' initdb --username="$IVORYSQL_USER" --pwfile=<(printf "%s\n" "$IVORYSQL_PASSWORD") ' " $POSTGRES_INITDB_ARGS " ' "$@"'
93
93
sed -ri " s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" $PGDATA /postgresql.conf
94
- sed -ri " s!^#?(ivorysql.listen_addresses)\s*=\s*\S+.*!\1 = '*'!" $PGDATA /ivorysql.conf
94
+ if [ -e " $PGDATA /ivorysql.conf" ]; then
95
+ sed -ri " s!^#?(ivorysql.listen_addresses)\s*=\s*\S+.*!\1 = '*'!" $PGDATA /ivorysql.conf
96
+ fi
95
97
# unset/cleanup "nss_wrapper" bits
96
98
if [[ " ${LD_PRELOAD:- } " == * /libnss_wrapper.so ]]; then
97
99
rm -f " $NSS_WRAPPER_PASSWD " " $NSS_WRAPPER_GROUP "
@@ -325,7 +327,7 @@ _main() {
325
327
pg_setup_hba_conf " $@ "
326
328
327
329
# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
328
- # e.g. when '--auth=md5' or '--auth-local=md5' is used in IVORYSQL_INITDB_ARGS
330
+ # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS
329
331
export PGPASSWORD=" ${PGPASSWORD:- $IVORYSQL_PASSWORD } "
330
332
docker_temp_server_start " $@ "
331
333
0 commit comments