[bitnami/discourse] Add support for Redis connections with SSL (#4174)
* Add support for Redis connections with SSL Co-authored-by: cgiorgetta <cgiorg@bluewin.ch> Signed-off-by: Arik Sidney Guggenheim <hello@arik.sydney> * Move REDIS_USE_SSL initialisation to discourse-env.sh Co-authored-by: cgiorgetta <cgiorg@bluewin.ch> Signed-off-by: Arik Sidney Guggenheim <hello@arik.sydney> * [bitnami/discourse] Introduce DISCOURSE_REDIS_USE_SSL (adapt to Bitnami style: valid values for DISCOURSE_REDIS_USE_SSL are 'yes'/'no'; turn on input validation on this parameter) Co-authored-by: cgiorgetta <cgiorg@bluewin.ch> Signed-off-by: Arik Sidney Guggenheim <hello@arik.sydney> * [bitnami/discourse] Introduce DISCOURSE_REDIS_USE_SSL (adapt to Bitnami style: valid values for DISCOURSE_REDIS_USE_SSL are 'yes'/'no'; turn on input validation on this parameter) Co-authored-by: cgiorgetta <cgiorg@bluewin.ch> Signed-off-by: Arik Sidney Guggenheim <hello@arik.sydney> * [bitnami/discourse] Introduce DISCOURSE_REDIS_USE_SSL (adapt to Bitnami style: valid values for DISCOURSE_REDIS_USE_SSL are 'yes'/'no'; turn on input validation on this parameter) Co-authored-by: Arik Sidney Guggenheim <hello@arik.sydney> Signed-off-by: Carlo Giorgetta <cgiorg@bluewin.ch> Signed-off-by: Arik Sidney Guggenheim <hello@arik.sydney> Signed-off-by: Carlo Giorgetta <cgiorg@bluewin.ch> Co-authored-by: cgiorgetta <cgiorg@bluewin.ch>
This commit is contained in:
parent
6ebfcd9ae5
commit
ccf2ace73a
|
|
@ -55,6 +55,7 @@ discourse_env_vars=(
|
|||
DISCOURSE_REDIS_HOST
|
||||
DISCOURSE_REDIS_PORT_NUMBER
|
||||
DISCOURSE_REDIS_PASSWORD
|
||||
DISCOURSE_REDIS_USE_SSL
|
||||
DISCOURSE_HOSTNAME
|
||||
DISCOURSE_SKIP_INSTALL
|
||||
SMTP_HOST
|
||||
|
|
@ -72,6 +73,7 @@ discourse_env_vars=(
|
|||
REDIS_HOST
|
||||
REDIS_PORT_NUMBER
|
||||
REDIS_PASSWORD
|
||||
REDIS_USE_SSL
|
||||
)
|
||||
for env_var in "${discourse_env_vars[@]}"; do
|
||||
file_env_var="${env_var}_FILE"
|
||||
|
|
@ -159,5 +161,7 @@ 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_USE_SSL="${DISCOURSE_REDIS_USE_SSL:-"${REDIS_USE_SSL:-}"}"
|
||||
export DISCOURSE_REDIS_USE_SSL="${DISCOURSE_REDIS_USE_SSL:-no}"
|
||||
|
||||
# Custom environment variables may be defined below
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ discourse_validate() {
|
|||
! is_empty_value "$DISCOURSE_DATABASE_PORT_NUMBER" && check_valid_port "DISCOURSE_DATABASE_PORT_NUMBER"
|
||||
! 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"
|
||||
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."
|
||||
|
|
@ -249,6 +250,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"
|
||||
is_boolean_yes "$DISCOURSE_REDIS_USE_SSL" && discourse_conf_set "redis_use_ssl" true
|
||||
# SMTP credentials
|
||||
if ! is_empty_value "$DISCOURSE_SMTP_HOST"; then
|
||||
info "Enabling SMTP"
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ Available environment variables:
|
|||
- `DISCOURSE_REDIS_HOST`: Hostname for Redis(R). Default: **redis**
|
||||
- `DISCOURSE_REDIS_PORT_NUMBER`: Port used by Redis(R). Default: **6379**
|
||||
- `DISCOURSE_REDIS_PASSWORD`: Password for Redis(R).
|
||||
- `DISCOURSE_REDIS_USE_SSL`: Whether to enable SSL for Redis(R). Default: **no**
|
||||
|
||||
##### Create a database for Discourse using postgresql-client
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue