mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-17 16:21:14 +02:00
fix: correct ENV export
Thanks to @polarathene for his feedback in https://github.com/docker-mailserver/docker-mailserver/pull/4323#pullrequestreview-2561071322 Signed-off-by: georglauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
parent
70eedac293
commit
06f7d42f46
3 changed files with 32 additions and 35 deletions
|
@ -38,7 +38,6 @@ function _register_functions() {
|
||||||
# ? >> Checks
|
# ? >> Checks
|
||||||
|
|
||||||
_register_check_function '_check_hostname'
|
_register_check_function '_check_hostname'
|
||||||
_register_check_function '_check_log_level'
|
|
||||||
_register_check_function '_check_spam_prefix'
|
_register_check_function '_check_spam_prefix'
|
||||||
|
|
||||||
# ? >> Setup
|
# ? >> Setup
|
||||||
|
@ -63,7 +62,6 @@ function _register_functions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
( 'LDAP' )
|
( 'LDAP' )
|
||||||
_environment_variables_ldap
|
|
||||||
_register_setup_function '_setup_ldap'
|
_register_setup_function '_setup_ldap'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -76,15 +74,8 @@ function _register_functions() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ ${ENABLE_OAUTH2} -eq 1 ]]; then
|
[[ ${ENABLE_OAUTH2} -eq 1 ]] && _register_setup_function '_setup_oauth2'
|
||||||
_environment_variables_oauth2
|
[[ ${ENABLE_SASLAUTHD} -eq 1 ]] && _register_setup_function '_setup_saslauthd'
|
||||||
_register_setup_function '_setup_oauth2'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${ENABLE_SASLAUTHD} -eq 1 ]]; then
|
|
||||||
_environment_variables_saslauthd
|
|
||||||
_register_setup_function '_setup_saslauthd'
|
|
||||||
fi
|
|
||||||
|
|
||||||
_register_setup_function '_setup_dovecot_inet_protocols'
|
_register_setup_function '_setup_dovecot_inet_protocols'
|
||||||
|
|
||||||
|
@ -138,7 +129,7 @@ function _register_functions() {
|
||||||
_register_start_daemon '_start_daemon_cron'
|
_register_start_daemon '_start_daemon_cron'
|
||||||
_register_start_daemon '_start_daemon_rsyslog'
|
_register_start_daemon '_start_daemon_rsyslog'
|
||||||
|
|
||||||
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
||||||
|
|
||||||
if [[ ${ENABLE_UPDATE_CHECK} -eq 1 ]]; then
|
if [[ ${ENABLE_UPDATE_CHECK} -eq 1 ]]; then
|
||||||
if [[ ${DMS_RELEASE} != 'edge' ]]; then
|
if [[ ${DMS_RELEASE} != 'edge' ]]; then
|
||||||
|
|
|
@ -26,24 +26,6 @@ function _check_hostname() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _check_log_level() {
|
|
||||||
if [[ ${LOG_LEVEL} == 'trace' ]] \
|
|
||||||
|| [[ ${LOG_LEVEL} == 'debug' ]] \
|
|
||||||
|| [[ ${LOG_LEVEL} == 'info' ]] \
|
|
||||||
|| [[ ${LOG_LEVEL} == 'warn' ]] \
|
|
||||||
|| [[ ${LOG_LEVEL} == 'error' ]]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
local DEFAULT_LOG_LEVEL='info'
|
|
||||||
_log 'warn' "Log level '${LOG_LEVEL}' is invalid (falling back to default '${DEFAULT_LOG_LEVEL}')"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
VARS[LOG_LEVEL]="${DEFAULT_LOG_LEVEL}"
|
|
||||||
LOG_LEVEL="${DEFAULT_LOG_LEVEL}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function _check_spam_prefix() {
|
function _check_spam_prefix() {
|
||||||
# This check should be independent of ENABLE_POP3 and ENABLE_IMAP
|
# This check should be independent of ENABLE_POP3 and ENABLE_IMAP
|
||||||
if [[ ${MOVE_SPAM_TO_JUNK} -eq 0 ]] \
|
if [[ ${MOVE_SPAM_TO_JUNK} -eq 0 ]] \
|
||||||
|
|
|
@ -4,9 +4,15 @@
|
||||||
declare -A VARS
|
declare -A VARS
|
||||||
|
|
||||||
function _early_variables_setup() {
|
function _early_variables_setup() {
|
||||||
|
__environment_variables_log_level
|
||||||
_obtain_hostname_and_domainname
|
_obtain_hostname_and_domainname
|
||||||
__environment_variables_backwards_compatibility
|
__environment_variables_backwards_compatibility
|
||||||
__environment_variables_general_setup
|
__environment_variables_general_setup
|
||||||
|
|
||||||
|
[[ ${ACCOUNT_PROVISIONER} == 'LDAP' ]] && __environment_variables_ldap
|
||||||
|
[[ ${ENABLE_OAUTH2} -eq 1 ]] && __environment_variables_oauth2
|
||||||
|
[[ ${ENABLE_SASLAUTHD} -eq 1 ]] && __environment_variables_saslauthd
|
||||||
|
|
||||||
__environment_variables_export
|
__environment_variables_export
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,15 +183,27 @@ function __environment_variables_general_setup() {
|
||||||
VARS[UPDATE_CHECK_INTERVAL]="${UPDATE_CHECK_INTERVAL:=1d}"
|
VARS[UPDATE_CHECK_INTERVAL]="${UPDATE_CHECK_INTERVAL:=1d}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _environment_variables_oauth2() {
|
function __environment_variables_log_level() {
|
||||||
_log 'debug' 'Setting OAUTH2-related environment variables now'
|
if [[ ${LOG_LEVEL} == 'trace' ]] \
|
||||||
|
|| [[ ${LOG_LEVEL} == 'debug' ]] \
|
||||||
|
|| [[ ${LOG_LEVEL} == 'info' ]] \
|
||||||
|
|| [[ ${LOG_LEVEL} == 'warn' ]] \
|
||||||
|
|| [[ ${LOG_LEVEL} == 'error' ]]
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
local DEFAULT_LOG_LEVEL='info'
|
||||||
|
_log 'warn' "Log level '${LOG_LEVEL}' is invalid (falling back to default '${DEFAULT_LOG_LEVEL}')"
|
||||||
|
|
||||||
VARS[OAUTH2_INTROSPECTION_URL]="${OAUTH2_INTROSPECTION_URL:=}"
|
# shellcheck disable=SC2034
|
||||||
|
VARS[LOG_LEVEL]="${DEFAULT_LOG_LEVEL}"
|
||||||
|
LOG_LEVEL="${DEFAULT_LOG_LEVEL}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function handles environment variables related to LDAP.
|
# This function handles environment variables related to LDAP.
|
||||||
# NOTE: SASLAuthd and Dovecot LDAP support inherit these common ENV.
|
# NOTE: SASLAuthd and Dovecot LDAP support inherit these common ENV.
|
||||||
function _environment_variables_ldap() {
|
function __environment_variables_ldap() {
|
||||||
_log 'debug' 'Setting LDAP-related environment variables now'
|
_log 'debug' 'Setting LDAP-related environment variables now'
|
||||||
|
|
||||||
VARS[LDAP_BIND_DN]="${LDAP_BIND_DN:=}"
|
VARS[LDAP_BIND_DN]="${LDAP_BIND_DN:=}"
|
||||||
|
@ -195,9 +213,15 @@ function _environment_variables_ldap() {
|
||||||
VARS[LDAP_START_TLS]="${LDAP_START_TLS:=no}"
|
VARS[LDAP_START_TLS]="${LDAP_START_TLS:=no}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __environment_variables_oauth2() {
|
||||||
|
_log 'debug' 'Setting OAUTH2-related environment variables now'
|
||||||
|
|
||||||
|
VARS[OAUTH2_INTROSPECTION_URL]="${OAUTH2_INTROSPECTION_URL:=}"
|
||||||
|
}
|
||||||
|
|
||||||
# This function handles environment variables related to SASLAUTHD
|
# This function handles environment variables related to SASLAUTHD
|
||||||
# LDAP specific ENV handled in: `startup/setup.d/saslauthd.sh:_setup_saslauthd()`
|
# LDAP specific ENV handled in: `startup/setup.d/saslauthd.sh:_setup_saslauthd()`
|
||||||
function _environment_variables_saslauthd() {
|
function __environment_variables_saslauthd() {
|
||||||
_log 'debug' 'Setting SASLAUTHD-related environment variables now'
|
_log 'debug' 'Setting SASLAUTHD-related environment variables now'
|
||||||
|
|
||||||
# This ENV is only used by the supervisor service config `saslauth.conf`:
|
# This ENV is only used by the supervisor service config `saslauth.conf`:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue