[bitnami/pgbouncer] Make hba file path configurable (#36733)

Signed-off-by: gtato <genc.tato@canonical.com>
This commit is contained in:
Genc Tato
2023-06-08 10:51:16 +02:00
committed by GitHub
parent 4274295290
commit a99086b3d5
2 changed files with 12 additions and 0 deletions

View File

@@ -64,6 +64,15 @@ pgbouncer_validate() {
fi
fi
# HBA Checks
if [[ "$PGBOUNCER_AUTH_TYPE" == "hba" ]] ; then
if [[ -z "$PGBOUNCER_AUTH_HBA_FILE" ]]; then
print_validation_error "A hba file was not provided. You need to set this value when specifying auth_type to hba"
elif [[ ! -f "$PGBOUNCER_AUTH_HBA_FILE" ]]; then
print_validation_error "The hba file in the specified path ${PGBOUNCER_AUTH_HBA_FILE} does not exist"
fi
fi
# TLS Checks (client)
if [[ "$PGBOUNCER_CLIENT_TLS_SSLMODE" != "disable" ]]; then
if [[ -z "$PGBOUNCER_CLIENT_TLS_CERT_FILE" ]]; then
@@ -228,6 +237,7 @@ pgbouncer_initialize() {
"unix_socket_group:${PGBOUNCER_SOCKET_GROUP}"
"auth_file:${PGBOUNCER_AUTH_FILE}"
"auth_type:${PGBOUNCER_AUTH_TYPE}"
"auth_hba_file:${PGBOUNCER_AUTH_HBA_FILE}"
"auth_query:${PGBOUNCER_AUTH_QUERY}"
"pidfile:${PGBOUNCER_PID_FILE}"
"logfile:${PGBOUNCER_LOG_FILE}"

View File

@@ -29,6 +29,7 @@ pgbouncer_env_vars=(
PGBOUNCER_AUTH_USER
PGBOUNCER_AUTH_QUERY
PGBOUNCER_AUTH_TYPE
PGBOUNCER_AUTH_HBA_FILE
PGBOUNCER_STATS_USERS
PGBOUNCER_POOL_MODE
PGBOUNCER_INIT_SLEEP_TIME
@@ -116,6 +117,7 @@ export PGBOUNCER_LISTEN_ADDRESS="${PGBOUNCER_LISTEN_ADDRESS:-0.0.0.0}"
export PGBOUNCER_AUTH_USER="${PGBOUNCER_AUTH_USER:-}"
export PGBOUNCER_AUTH_QUERY="${PGBOUNCER_AUTH_QUERY:-}"
export PGBOUNCER_AUTH_TYPE="${PGBOUNCER_AUTH_TYPE:-md5}"
export PGBOUNCER_AUTH_HBA_FILE="${PGBOUNCER_AUTH_HBA_FILE:-}"
export PGBOUNCER_STATS_USERS="${PGBOUNCER_STATS_USERS:-}"
export PGBOUNCER_POOL_MODE="${PGBOUNCER_POOL_MODE:-}"
export PGBOUNCER_INIT_SLEEP_TIME="${PGBOUNCER_INIT_SLEEP_TIME:-10}"