Skip to content

Commit

Permalink
[bitnami/postgresql-repmgr] Delay custom pg_hba.conf injection
Browse files Browse the repository at this point in the history
Signed-off-by: Yukha Dharmeswara <yukha.dw@samsung.com>
  • Loading branch information
yukha-dw committed Nov 1, 2024
1 parent 2de4377 commit fc7abeb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
if repmgr_is_file_external "pg_hba.conf"; then
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
else
repmgr_inject_pghba_configuration
fi
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
chmod 600 "${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -864,6 +860,9 @@ repmgr_initialize() {
fi
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
if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
if repmgr_is_file_external "pg_hba.conf"; then
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
else
repmgr_inject_pghba_configuration
fi
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
chmod 600 "${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -864,6 +860,9 @@ repmgr_initialize() {
fi
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
if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
if repmgr_is_file_external "pg_hba.conf"; then
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
else
repmgr_inject_pghba_configuration
fi
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
chmod 600 "${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -864,6 +860,9 @@ repmgr_initialize() {
fi
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
if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
if repmgr_is_file_external "pg_hba.conf"; then
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
else
repmgr_inject_pghba_configuration
fi
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
chmod 600 "${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -864,6 +860,9 @@ repmgr_initialize() {
fi
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
if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() {
else
repmgr_inject_postgresql_configuration
fi
if repmgr_is_file_external "pg_hba.conf"; then
cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf"
else
repmgr_inject_pghba_configuration
fi
repmgr_inject_pghba_configuration
if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then
echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}"
chmod 600 "${REPMGR_PASSFILE_PATH}"
Expand Down Expand Up @@ -864,6 +860,9 @@ repmgr_initialize() {
fi
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
if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then
Expand Down

0 comments on commit fc7abeb

Please sign in to comment.