From 5298271bfd9b12c76b914fca6d6a66540ad57816 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Sun, 30 Oct 2016 12:42:29 +0100 Subject: [PATCH] Fixes #364 - hostname/domainame is required. (#368) --- target/start-mailserver.sh | 10 +++++++++- test/tests.bats | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index adf47451..cb3a9b43 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -1,10 +1,18 @@ #!/bin/bash die () { - echo >&2 "$@" + echo "## Configuration error:" + echo >&2 "> $@" exit 1 } +# +# Check that hostname/domainname is provided (no default docker hostname) +# +if ( ! echo $(hostname) | grep -E '^(\S+[.]\S+)$' ); then + die "Setting hostname/domainname is required." +fi + # # Default variables # diff --git a/test/tests.bats b/test/tests.bats index 6439a27b..58fa2aa2 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -1,3 +1,12 @@ +# +# configuration checks +# + +@test "checking configuration: hostname/domainname" { + run docker run `docker inspect --format '{{ .Config.Image }}' mail` + [ "$status" -eq 1 ] +} + # # processes #