mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-09-11 12:10:47 +08:00
print value being set in recovery.conf
This commit is contained in:
+7
-3
@@ -73,10 +73,14 @@ set_postgresql_param() {
|
|||||||
set_recovery_param() {
|
set_recovery_param() {
|
||||||
local key=${1}
|
local key=${1}
|
||||||
local value=${2}
|
local value=${2}
|
||||||
|
local hide=${3}
|
||||||
if [[ -n ${value} ]]; then
|
if [[ -n ${value} ]]; then
|
||||||
local current=$(exec_as_postgres sed -n -e "s/^\(.*\)\("${key}"=\)\([^ ']*\)\(.*\)$/\3/p" ${PG_RECOVERY_CONF})
|
local current=$(exec_as_postgres sed -n -e "s/^\(.*\)\("${key}"=\)\([^ ']*\)\(.*\)$/\3/p" ${PG_RECOVERY_CONF})
|
||||||
if [[ "${current}" != "${value}" ]]; then
|
if [[ "${current}" != "${value}" ]]; then
|
||||||
echo "Updating primary_conninfo ${key}..."
|
case ${hide} in
|
||||||
|
true) echo "‣ Setting primary_conninfo parameter: ${key}" ;;
|
||||||
|
*) echo "‣ Setting primary_conninfo parameter: ${key} = '${value}'" ;;
|
||||||
|
esac
|
||||||
exec_as_postgres sed -i "s|"${key}"=[^ ']*|"${key}"="${value}"|" ${PG_RECOVERY_CONF}
|
exec_as_postgres sed -i "s|"${key}"=[^ ']*|"${key}"="${value}"|" ${PG_RECOVERY_CONF}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -250,9 +254,9 @@ trust_localnet() {
|
|||||||
|
|
||||||
configure_recovery() {
|
configure_recovery() {
|
||||||
if [[ ${REPLICATION_MODE} == slave ]]; then
|
if [[ ${REPLICATION_MODE} == slave ]]; then
|
||||||
|
echo "Configuring recovery..."
|
||||||
if [[ ! -f ${PG_RECOVERY_CONF} ]]; then
|
if [[ ! -f ${PG_RECOVERY_CONF} ]]; then
|
||||||
# initialize recovery.conf on the firstrun (slave only)
|
# initialize recovery.conf on the firstrun (slave only)
|
||||||
echo "Configuring recovery..."
|
|
||||||
exec_as_postgres touch ${PG_RECOVERY_CONF}
|
exec_as_postgres touch ${PG_RECOVERY_CONF}
|
||||||
( echo "standby_mode = 'on'";
|
( echo "standby_mode = 'on'";
|
||||||
echo "primary_conninfo = 'host=${REPLICATION_HOST} port=${REPLICATION_PORT} user=${REPLICATION_USER} password=${REPLICATION_PASS} sslmode=${REPLICATION_SSLMODE}'";
|
echo "primary_conninfo = 'host=${REPLICATION_HOST} port=${REPLICATION_PORT} user=${REPLICATION_USER} password=${REPLICATION_PASS} sslmode=${REPLICATION_SSLMODE}'";
|
||||||
@@ -261,7 +265,7 @@ configure_recovery() {
|
|||||||
set_recovery_param "host" "${REPLICATION_HOST}"
|
set_recovery_param "host" "${REPLICATION_HOST}"
|
||||||
set_recovery_param "port" "${REPLICATION_PORT}"
|
set_recovery_param "port" "${REPLICATION_PORT}"
|
||||||
set_recovery_param "user" "${REPLICATION_USER}"
|
set_recovery_param "user" "${REPLICATION_USER}"
|
||||||
set_recovery_param "password" "${REPLICATION_PASS}"
|
set_recovery_param "password" "${REPLICATION_PASS}" "true"
|
||||||
set_recovery_param "sslmode" "${REPLICATION_SSLMODE}"
|
set_recovery_param "sslmode" "${REPLICATION_SSLMODE}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user