1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-07-28 10:42:06 +03:00

Refactor listen_addresses to be set in the sample file, and make the sample file easier to overwrite

This commit is contained in:
Tianon Gravi
2016-02-26 10:55:10 -08:00
parent ec5ce80ca9
commit 41e7a62fb4
2 changed files with 8 additions and 5 deletions

View File

@ -1,10 +1,9 @@
#!/bin/bash
set -e
set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi
if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'
echo
echo 'PostgreSQL init process complete; ready for start up.'