From 0fb4a6d082cc0a3c8a5d3ff6193d1032329d11d4 Mon Sep 17 00:00:00 2001 From: Daniel Panteleit <15816819+danielpanteleit@users.noreply.github.com> Date: Sun, 11 Nov 2018 20:46:53 +0100 Subject: [PATCH] Clear up env format and hostname value (#1076) * Describe format for .env in README * Display used domain and hostname even when they are not acceptable This should be clearer for the user when the hostname was set incorrectly. --- README.md | 3 +++ target/start-mailserver.sh | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a0c6fcd..bd5ed88b 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ Download the docker-compose.yml, the .env and the setup.sh files: #### Create a docker-compose environment - Edit the `.env` to your liking. Adapt this file with your FQDN. + - This file supports only simple `VAR=VAL` lines (see [Documentation](https://docs.docker.com/compose/env-file/)). + - Don't quote your values. + - Variable substitution is *not* supported (e.g. `OVERRIDE_HOSTNAME=$HOSTNAME.$DOMAINNAME`). - Install [docker-compose](https://docs.docker.com/compose/) in the version `1.6` or higher. #### Start Container diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 4ccff1ec..3af2805a 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -387,12 +387,13 @@ function _check_hostname() { export DOMAINNAME=$(echo $HOSTNAME | sed s/[^.]*.//) fi + notify 'inf' "Domain has been set to $DOMAINNAME" + notify 'inf' "Hostname has been set to $HOSTNAME" + if ( ! echo $HOSTNAME | grep -E '^(\S+[.]\S+)$' > /dev/null ); then notify 'err' "Setting hostname/domainname is required" kill `cat /var/run/supervisord.pid` && return 1 else - notify 'inf' "Domain has been set to $DOMAINNAME" - notify 'inf' "Hostname has been set to $HOSTNAME" return 0 fi }