From a4ed7d0087107fce8f6ae32ab36a6d3caf5286ea Mon Sep 17 00:00:00 2001 From: Mykhailo Nenych Date: Tue, 10 Sep 2024 12:00:40 +0200 Subject: [PATCH] Add DISCOURSE_REDIS_DB to make it configurable (#71811) * Add DISCOURSE_REDIS_DB to make it configurable Signed-off-by: nenych * Set 0 as the default DISCOURSE_REDIS_DB value Signed-off-by: nenych * Reset docker-compose Signed-off-by: nenych --------- Signed-off-by: nenych --- .../3/debian-12/rootfs/opt/bitnami/scripts/discourse-env.sh | 4 ++++ .../3/debian-12/rootfs/opt/bitnami/scripts/libdiscourse.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/discourse-env.sh b/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/discourse-env.sh index 525ba6c42828..994d2dd59f08 100644 --- a/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/discourse-env.sh +++ b/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/discourse-env.sh @@ -61,6 +61,7 @@ discourse_env_vars=( DISCOURSE_REDIS_HOST DISCOURSE_REDIS_PORT_NUMBER DISCOURSE_REDIS_PASSWORD + DISCOURSE_REDIS_DB DISCOURSE_REDIS_USE_SSL DISCOURSE_HOSTNAME DISCOURSE_SKIP_INSTALL @@ -79,6 +80,7 @@ discourse_env_vars=( REDIS_HOST REDIS_PORT_NUMBER REDIS_PASSWORD + REDIS_DB REDIS_USE_SSL ) for env_var in "${discourse_env_vars[@]}"; do @@ -172,6 +174,8 @@ DISCOURSE_REDIS_PORT_NUMBER="${DISCOURSE_REDIS_PORT_NUMBER:-"${REDIS_PORT_NUMBER export DISCOURSE_REDIS_PORT_NUMBER="${DISCOURSE_REDIS_PORT_NUMBER:-6379}" DISCOURSE_REDIS_PASSWORD="${DISCOURSE_REDIS_PASSWORD:-"${REDIS_PASSWORD:-}"}" export DISCOURSE_REDIS_PASSWORD="${DISCOURSE_REDIS_PASSWORD:-}" +DISCOURSE_REDIS_DB="${DISCOURSE_REDIS_DB:-"${REDIS_DB:-}"}" +export DISCOURSE_REDIS_DB="${DISCOURSE_REDIS_DB:-0}" DISCOURSE_REDIS_USE_SSL="${DISCOURSE_REDIS_USE_SSL:-"${REDIS_USE_SSL:-}"}" export DISCOURSE_REDIS_USE_SSL="${DISCOURSE_REDIS_USE_SSL:-no}" diff --git a/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/libdiscourse.sh b/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/libdiscourse.sh index 2d17aab02c2f..6c620d143b95 100644 --- a/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/libdiscourse.sh +++ b/bitnami/discourse/3/debian-12/rootfs/opt/bitnami/scripts/libdiscourse.sh @@ -91,6 +91,7 @@ discourse_validate() { ! is_empty_value "$DISCOURSE_REDIS_HOST" && check_resolved_hostname "$DISCOURSE_REDIS_HOST" ! is_empty_value "$DISCOURSE_REDIS_PORT_NUMBER" && check_valid_port "DISCOURSE_REDIS_PORT_NUMBER" ! is_empty_value "$DISCOURSE_REDIS_USE_SSL" && check_yes_no_value "DISCOURSE_REDIS_USE_SSL" + ! is_empty_value "$DISCOURSE_REDIS_DB" && is_positive_int "$DISCOURSE_REDIS_DB" if ! is_file_writable "$DISCOURSE_CONF_FILE"; then warn "The Discourse configuration file ${DISCOURSE_CONF_FILE} is not writable. Configurations specified via environment variables will not be applied to this file." is_boolean_yes "$DISCOURSE_ENABLE_CONF_PERSISTENCE" && warn "The DISCOURSE_ENABLE_CONF_PERSISTENCE configuration is enabled but the ${DISCOURSE_CONF_FILE} file is not writable. The file will not be persisted." @@ -255,6 +256,7 @@ discourse_create_conf_file() { discourse_conf_set "redis_host" "$DISCOURSE_REDIS_HOST" discourse_conf_set "redis_port" "$DISCOURSE_REDIS_PORT_NUMBER" discourse_conf_set "redis_password" "$DISCOURSE_REDIS_PASSWORD" + discourse_conf_set "redis_db" "$DISCOURSE_REDIS_DB" is_boolean_yes "$DISCOURSE_REDIS_USE_SSL" && discourse_conf_set "redis_use_ssl" true # SMTP credentials if ! is_empty_value "$DISCOURSE_SMTP_HOST"; then