mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-08-12 12:00:50 +08:00
start: removed pwfile logic
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**latest**
|
||||||
|
- start: removed `pwfile` logic
|
||||||
|
|
||||||
**9.4**
|
**9.4**
|
||||||
- postgresql: upgrade to 9.4
|
- postgresql: upgrade to 9.4
|
||||||
|
|
||||||
|
|||||||
@@ -52,14 +52,8 @@ if [ ! -d ${PG_DATADIR} ]; then
|
|||||||
# check if we need to perform data migration
|
# check if we need to perform data migration
|
||||||
PG_OLD_VERSION=$(find ${PG_HOME}/[0-9].[0-9]/main -maxdepth 1 -name PG_VERSION 2>/dev/null | sort -r | head -n1 | cut -d'/' -f5)
|
PG_OLD_VERSION=$(find ${PG_HOME}/[0-9].[0-9]/main -maxdepth 1 -name PG_VERSION 2>/dev/null | sort -r | head -n1 | cut -d'/' -f5)
|
||||||
|
|
||||||
if [ ! -f "${PG_HOME}/pwfile" ]; then
|
|
||||||
PG_PASSWORD=$(pwgen -c -n -1 14)
|
|
||||||
echo "${PG_PASSWORD}" > ${PG_HOME}/pwfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Initializing database..."
|
echo "Initializing database..."
|
||||||
sudo -u postgres -H "${PG_BINDIR}/initdb" \
|
sudo -u postgres -H "${PG_BINDIR}/initdb" --pgdata="${PG_DATADIR}" \
|
||||||
--pgdata="${PG_DATADIR}" --pwfile=${PG_HOME}/pwfile \
|
|
||||||
--username=postgres --encoding=unicode --auth=trust >/dev/null
|
--username=postgres --encoding=unicode --auth=trust >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -88,17 +82,6 @@ if [ -n "${PG_OLD_VERSION}" ]; then
|
|||||||
-O "-c config_file=${PG_CONFDIR}/postgresql.conf" >/dev/null
|
-O "-c config_file=${PG_CONFDIR}/postgresql.conf" >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${PG_HOME}/pwfile ]; then
|
|
||||||
PG_PASSWORD=$(cat ${PG_HOME}/pwfile)
|
|
||||||
echo "|------------------------------------------------------------------|"
|
|
||||||
echo "| PostgreSQL User: postgres, Password: ${PG_PASSWORD} |"
|
|
||||||
echo "| |"
|
|
||||||
echo "| To remove the PostgreSQL login credentials from the logs, please |"
|
|
||||||
echo "| make a note of password and then delete the file pwfile |"
|
|
||||||
echo "| from the data store. |"
|
|
||||||
echo "|------------------------------------------------------------------|"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${DB_USER}" ]; then
|
if [ -n "${DB_USER}" ]; then
|
||||||
if [ -z "${DB_PASS}" ]; then
|
if [ -z "${DB_PASS}" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user