mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
b7e5d42e09
* consistently name functions (starting with `_`) in `start-mailserver.sh` Most of the functions that execute the different stacks during startup were not prefixed with `_`, but all our other functions are. This has now been fixed. * cleanup in `start-mailserver.sh` I adjusted the comments for all sections in the start script so they are properly displayed again.
44 lines
1,018 B
Bash
44 lines
1,018 B
Bash
#! /bin/bash
|
|
|
|
function _check
|
|
{
|
|
_log 'info' 'Checking configuration'
|
|
for FUNC in "${FUNCS_CHECK[@]}"
|
|
do
|
|
${FUNC}
|
|
done
|
|
}
|
|
|
|
function _check_hostname
|
|
{
|
|
_log 'debug' 'Checking that hostname/domainname is provided or overridden'
|
|
|
|
_log 'debug' "Domain has been set to ${DOMAINNAME}"
|
|
_log 'debug' "Hostname has been set to ${HOSTNAME}"
|
|
|
|
# HOSTNAME should be an FQDN (eg: hostname.domain)
|
|
if ! grep -q -E '^(\S+[.]\S+)$' <<< "${HOSTNAME}"
|
|
then
|
|
_shutdown 'Setting hostname/domainname is required'
|
|
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
|
|
}
|