You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-29 21:41:20 +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:
@ -36,6 +36,11 @@ RUN apt-get update \
|
||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
|
@ -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.'
|
||||
|
Reference in New Issue
Block a user