mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-07-11 05:31:14 +08:00
added PG_PASSWORD variable to specify password for postgres user
Refer #43
This commit is contained in:
+5
-1
@@ -203,8 +203,12 @@ initialize_database() {
|
||||
mv ${PG_HOME}/${PG_OLD_VERSION}.migrating ${PG_HOME}/${PG_OLD_VERSION}
|
||||
fi
|
||||
|
||||
if [[ -n $PG_PASSWORD ]]; then
|
||||
echo "${PG_PASSWORD}" > /tmp/pwfile
|
||||
fi
|
||||
|
||||
exec_as_postgres ${PG_BINDIR}/initdb --pgdata=${PG_DATADIR} \
|
||||
--username=${PG_USER} --encoding=unicode --auth=trust >/dev/null
|
||||
--username=${PG_USER} --encoding=unicode --auth=trust ${PG_PASSWORD:+--pwfile=/tmp/pwfile} >/dev/null
|
||||
|
||||
if [[ -n ${PG_OLD_VERSION} ]]; then
|
||||
PG_OLD_BINDIR=/usr/lib/postgresql/${PG_OLD_VERSION}/bin
|
||||
|
||||
Reference in New Issue
Block a user