diff --git a/swarm-proxy-letsencrypt/99-swarm-proxy-letsencrypt-entry.sh b/swarm-proxy-letsencrypt/99-swarm-proxy-letsencrypt-entry.sh
index 55993953ad438de5d07d1cc55023e0114fbf5978..792f59a58e56397e49b65f0698b34e7db5e6c25e 100755
--- a/swarm-proxy-letsencrypt/99-swarm-proxy-letsencrypt-entry.sh
+++ b/swarm-proxy-letsencrypt/99-swarm-proxy-letsencrypt-entry.sh
@@ -148,6 +148,12 @@ if [[ "${ACME_CA_URI:-}" =~ $acmev1_r ]]; then
     echo "Please use one of Let's Encrypt ACME v2 endpoints instead."
     exit 1
 fi
+
+if [[ -z "${LB_DOMAIN:-}" ]]; then
+    echo "Error: LB_DOMAIN env variable not set. Caught in entry script."
+    exit 1
+fi
+
 check_docker_socket
 check_writable_directory '/etc/nginx/certs'
 check_writable_directory '/etc/nginx/vhost.d'
@@ -182,9 +188,9 @@ cat > "/usr/share/nginx/html/.well-known/acme-challenge/active.html" << EOF
 EOF
 
 
-cat > "/etc/nginx/conf.d/lb.qoto.org-activate.conf" << EOF
+cat > "/etc/nginx/conf.d/${LB_DOMAIN}-activate.conf" << EOF
 server {
-    server_name lb.qoto.org;
+    server_name ${LB_DOMAIN};
     listen 80;
 
     include /etc/nginx/vhost.d/default*;
diff --git a/swarm-proxy-letsencrypt/app/functions.sh b/swarm-proxy-letsencrypt/app/functions.sh
index 858d7539a0d9d10a918fcc3aafe18caa5e657512..9c519b69dfd940d6a937fe103bba6424384fb5b0 100644
--- a/swarm-proxy-letsencrypt/app/functions.sh
+++ b/swarm-proxy-letsencrypt/app/functions.sh
@@ -8,15 +8,20 @@ function lc {
 DEBUG="$(lc "$DEBUG")"
 
 [[ -z "${VHOST_DIR:-}" ]] && \
- declare -r VHOST_DIR=/etc/nginx/vhost.d
+   declare -r VHOST_DIR=/etc/nginx/vhost.d
 [[ -z "${START_HEADER:-}" ]] && \
- declare -r START_HEADER='## Start of configuration add by letsencrypt container'
+   declare -r START_HEADER='## Start of configuration add by letsencrypt container'
 [[ -z "${END_HEADER:-}" ]] && \
- declare -r END_HEADER='## End of configuration add by letsencrypt container'
+   declare -r END_HEADER='## End of configuration add by letsencrypt container'
+if [[ -z "${LB_DOMAIN:-}" ]]; then
+   echo "Error: LB_DOMAIN env variable not set. Caught in functions script."
+   exit 1
+fi
+
 
 function check_nginx_proxy_container_run {
     # TODO make the load balancer address configurable.
-    if curl --head --silent --fail http://lb.qoto.org/.well-known/acme-challenge/active.html > /dev/null;
+    if curl --head --silent --fail http://${LB_DOMAIN}/.well-known/acme-challenge/active.html > /dev/null;
     then
         return 0
     else