diff --git a/upgrade/traefik_fail2ban.sh b/upgrade/traefik_fail2ban.sh
index 64e5cdf2429dd3425cfd05aac69b4ba4d30045a8..ad8ebd047297c949c4dd6bff31507ba51f29e4cf 100644
--- a/upgrade/traefik_fail2ban.sh
+++ b/upgrade/traefik_fail2ban.sh
@@ -1,5 +1,15 @@
 #!/bin/bash
 
+DIR=$(realpath $(dirname $0)/..)
+if [ ! -e $DIR/main.env ]
+then
+    echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it"
+    exit 1
+else
+    echo "Environment file loaded"
+fi
+. $DIR/main.env
+
 cat <<EOF > /etc/fail2ban/jail.d/nocloud_traefik.conf
 [traefik-auth]
 enabled = true