mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
scripts/ENV: make disabling Redis possible (#3132)
* make disabling Redis possible * add documentation * Apply suggestions from code review * Update docs/content/config/environment.md --------- Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
parent
dfc2b39308
commit
0949f16344
|
@ -80,6 +80,26 @@ Enable or disable Rspamd.
|
|||
- **0** => disabled
|
||||
- 1 => enabled
|
||||
|
||||
##### ENABLE_REDIS
|
||||
|
||||
Explicit control over running a Redis instance within the container. By default, this value will match what is set for [`ENABLE_RSPAMD`](#enable_rspamd).
|
||||
|
||||
The purpose of this setting is to opt-out of starting an internal Redis instance when enabling Rspamd, replacing it with your own external instance.
|
||||
|
||||
??? note "Configuring rspamd for an external Redis instance"
|
||||
|
||||
You will need to [provide configuration][config-rspamd-redis] at `/etc/rspamd/local.d/redis.conf` similar to:
|
||||
|
||||
```
|
||||
servers = "redis.example.test:6379";
|
||||
expand_keys = true;
|
||||
```
|
||||
|
||||
[config-rspamd-redis]: https://rspamd.com/doc/configuration/redis.html
|
||||
|
||||
- 0 => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
##### ENABLE_AMAVIS
|
||||
|
||||
Amavis content filter (used for ClamAV & SpamAssassin)
|
||||
|
|
|
@ -118,10 +118,16 @@ ENABLE_POP3=
|
|||
ENABLE_CLAMAV=0
|
||||
|
||||
# Enables Rspamd
|
||||
# **0** => disabled
|
||||
# 1 => enabled
|
||||
# **0** => Disabled
|
||||
# 1 => Enabled
|
||||
ENABLE_RSPAMD=0
|
||||
|
||||
# When `ENABLE_RSPAMD=1`, an internal Redis instance is enabled implicitly.
|
||||
# This setting provides an opt-out to allow using an external instance instead.
|
||||
# 0 => Disabled
|
||||
# 1 => Enabled
|
||||
ENABLE_REDIS=
|
||||
|
||||
# Amavis content filter (used for ClamAV & SpamAssassin)
|
||||
# 0 => Disabled
|
||||
# 1 => Enabled
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# documentation: https://rspamd.com/doc/configuration/redis.html
|
||||
|
||||
servers = "127.0.0.1:6379";
|
||||
expand_keys = true;
|
|
@ -124,15 +124,10 @@ function _register_functions
|
|||
_register_start_daemon '_start_daemon_rsyslog'
|
||||
|
||||
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
||||
|
||||
[[ ${ENABLE_UPDATE_CHECK} -eq 1 ]] && _register_start_daemon '_start_daemon_update_check'
|
||||
|
||||
if [[ ${ENABLE_RSPAMD} -eq 1 ]]
|
||||
then
|
||||
_register_start_daemon '_start_daemon_redis'
|
||||
_register_start_daemon '_start_daemon_rspamd'
|
||||
fi
|
||||
|
||||
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
||||
[[ ${ENABLE_REDIS} -eq 1 ]] && _register_start_daemon '_start_daemon_rspamd'
|
||||
[[ ${ENABLE_RSPAMD} -eq 1 ]] && _register_start_daemon '_start_daemon_redis'
|
||||
[[ ${ENABLE_UPDATE_CHECK} -eq 1 ]] && _register_start_daemon '_start_daemon_update_check'
|
||||
|
||||
# needs to be started before SASLauthd
|
||||
|
|
|
@ -46,6 +46,20 @@ function __rspamd__preflight_checks
|
|||
else
|
||||
__rspamd__log 'debug' 'Rspamd will not use ClamAV (which has not been enabled)'
|
||||
fi
|
||||
|
||||
if [[ ${ENABLE_REDIS} -eq 1 ]]
|
||||
then
|
||||
__rspamd__log 'trace' 'Internal Redis is enabled, adding configuration'
|
||||
cat >/etc/rspamd/local.d/redis.conf << "EOF"
|
||||
# documentation: https://rspamd.com/doc/configuration/redis.html
|
||||
|
||||
servers = "127.0.0.1:6379";
|
||||
expand_keys = true;
|
||||
|
||||
EOF
|
||||
else
|
||||
__rspamd__log 'debug' 'Rspamd will not use internal Redis (which has been disabled)'
|
||||
fi
|
||||
}
|
||||
|
||||
# Adjust Postfix's configuration files. Append Rspamd at the end of
|
||||
|
|
|
@ -77,6 +77,7 @@ function __environment_variables_general_setup
|
|||
VARS[ENABLE_POSTGREY]="${ENABLE_POSTGREY:=0}"
|
||||
VARS[ENABLE_QUOTAS]="${ENABLE_QUOTAS:=1}"
|
||||
VARS[ENABLE_RSPAMD]="${ENABLE_RSPAMD:=0}"
|
||||
VARS[ENABLE_REDIS]="${ENABLE_REDIS:=${ENABLE_RSPAMD}}"
|
||||
VARS[ENABLE_SASLAUTHD]="${ENABLE_SASLAUTHD:=0}"
|
||||
VARS[ENABLE_SPAMASSASSIN]="${ENABLE_SPAMASSASSIN:=0}"
|
||||
VARS[ENABLE_SPAMASSASSIN_KAM]="${ENABLE_SPAMASSASSIN_KAM:=0}"
|
||||
|
|
Loading…
Reference in a new issue