Skip to content

Commit

Permalink
[bitnami/postgresql-repmgr] Fix unwanted mount of custom pg_hba.conf …
Browse files Browse the repository at this point in the history
…to `POSTGRESQL_MOUNTED_CONF_DIR`

Co-authored-by: Miguel Ruiz <[email protected]>
Signed-off-by: Yukha Dharmeswara <[email protected]>
  • Loading branch information
yukha-dw and migruiz4 committed Nov 6, 2024
1 parent fc7abeb commit 35cd8b0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
# Inject default pghba configuration
# May be override by custom ph_hba.conf later after initialization
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -861,7 +863,6 @@ repmgr_initialize() {
if ! repmgr_is_file_external "pg_hba.conf"; then
is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba
else
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf"
fi
if [[ "$REPMGR_ROLE" = "primary" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
# Inject default pghba configuration
# May be override by custom ph_hba.conf later after initialization
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -861,7 +863,6 @@ repmgr_initialize() {
if ! repmgr_is_file_external "pg_hba.conf"; then
is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba
else
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf"
fi
if [[ "$REPMGR_ROLE" = "primary" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
# Inject default pghba configuration
# May be override by custom ph_hba.conf later after initialization
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -861,7 +863,6 @@ repmgr_initialize() {
if ! repmgr_is_file_external "pg_hba.conf"; then
is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba
else
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf"
fi
if [[ "$REPMGR_ROLE" = "primary" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
# Inject default pghba configuration
# May be override by custom ph_hba.conf later after initialization
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -861,7 +863,6 @@ repmgr_initialize() {
if ! repmgr_is_file_external "pg_hba.conf"; then
is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba
else
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf"
fi
if [[ "$REPMGR_ROLE" = "primary" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
# Inject default pghba configuration
# May be override by custom ph_hba.conf later after initialization
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -861,7 +863,6 @@ repmgr_initialize() {
if ! repmgr_is_file_external "pg_hba.conf"; then
is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba
else
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf"
fi
if [[ "$REPMGR_ROLE" = "primary" ]]; then
Expand Down

0 comments on commit 35cd8b0

Please sign in to comment.