From b30633558216775e23d725c54729980e8b89252d Mon Sep 17 00:00:00 2001 From: Tobias Lindberg Date: Wed, 19 Jun 2024 11:12:31 +0200 Subject: [PATCH] fix: resolving fatal when disabling of mqtt fix #281 --- src/webserver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webserver.go b/src/webserver.go index 0785900..75a4220 100644 --- a/src/webserver.go +++ b/src/webserver.go @@ -58,8 +58,10 @@ func main() { // Connect to the MQTT broker statusCache, err := startMQTT() - if err != nil { + if !getEnvAsBool("DISABLE_MQTT", false) && err != nil { log.Fatalf("[error] TeslaMateApi MQTT connection failed: %s", err) + } else if getEnvAsBool("DISABLE_MQTT", false) { + log.Println("[info] TeslaMateApi MQTT connection not established.") } if getEnvAsBool("API_TOKEN_DISABLE", false) {