mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
c267d8a990
Centralize the collection of the HOSTNAME and DOMAINAME so that it's predictable and uniform across the various scripts (using the helper). Ensure it supports the various configurations users can have (both subdomain and without subdomain, override and no override). --- * using _obtain_hostname_and_domainname helper + covers when not a subdomain doc: OVERRIDE_HOSTNAME takes priority * added tests for non-subdomain hostname + further improvements * moved SRS DOMAINANME tests into hostname test file + Allowing DOMAINNAME ENV to override what would be automatically set --- Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
26 lines
519 B
Bash
26 lines
519 B
Bash
#! /bin/bash
|
|
|
|
function check
|
|
{
|
|
_notify 'tasklog' 'Checking configuration'
|
|
for FUNC in "${FUNCS_CHECK[@]}"
|
|
do
|
|
${FUNC} || _defunc
|
|
done
|
|
}
|
|
|
|
function _check_hostname
|
|
{
|
|
_notify 'task' 'Checking that hostname/domainname is provided or overridden'
|
|
|
|
_notify 'inf' "Domain has been set to ${DOMAINNAME}"
|
|
_notify 'inf' "Hostname has been set to ${HOSTNAME}"
|
|
|
|
if ! grep -q -E '^(\S+[.]\S+)$' <<< "${HOSTNAME}"
|
|
then
|
|
_notify 'err' 'Setting hostname/domainname is required'
|
|
_shutdown
|
|
return 1
|
|
fi
|
|
}
|