File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -61,15 +61,16 @@ set -e
6161
6262version_major=$(psql --version | sed -z "s/psql (PostgreSQL) //g" | grep -Eo -m 1 "^([0-9]+)" | sed -z "s/-//g")
6363
64+ echo "listen_addresses = '*'" >> /etc/postgresql/${version_major}/main/postgresql.conf \
65+ && echo "data_directory = '$PGDATA'" >> /etc/postgresql/${version_major}/main/postgresql.conf \
66+ && echo "host all all 0.0.0.0/0 trust" > /etc/postgresql/${version_major}/main/pg_hba.conf \
67+ && echo "host all all ::/0 trust" >> /etc/postgresql/${version_major}/main/pg_hba.conf \
68+ && echo "host all all ::1/128 trust" >> /etc/postgresql/${version_major}/main/pg_hba.conf
69+
6470if [ ! -f "$PGDATA/PG_VERSION" ]; then
6571 echo "Initializing PostgreSQL database..."
6672 chown -R postgres:postgres $PGDATA \
6773 && chmod 0750 $PGDATA \
68- && echo "listen_addresses = '*'" >> /etc/postgresql/${version_major}/main/postgresql.conf \
69- && echo "data_directory = '$PGDATA'" >> /etc/postgresql/${version_major}/main/postgresql.conf \
70- && echo "host all all 0.0.0.0/0 trust" > /etc/postgresql/${version_major}/main/pg_hba.conf \
71- && echo "host all all ::/0 trust" >> /etc/postgresql/${version_major}/main/pg_hba.conf \
72- && echo "host all all ::1/128 trust" >> /etc/postgresql/${version_major}/main/pg_hba.conf \
7374 && sudo -H -u postgres sh -c "/usr/lib/postgresql/${version_major}/bin/initdb -D $PGDATA --auth-local trust --auth-host scram-sha-256"
7475else
7576 echo "PostgreSQL database already initialized, skipping initialization"
You can’t perform that action at this time.
0 commit comments