diff --git a/main.go b/main.go index bcd73b8..f3ff93c 100644 --- a/main.go +++ b/main.go @@ -453,6 +453,10 @@ func main() { logger.Infof("Listening on %s, ntfy-alertmanager %s", cfg.HTTPAddress, version) mux := http.NewServeMux() + httpServer := &http.Server{ + Addr: cfg.HTTPAddress, + Handler: mux, + } if cfg.User != "" && cfg.Password != "" { logger.Info("Enabling HTTP Basic Authentication") @@ -466,5 +470,5 @@ func main() { if _, ok := c.(*cache.MemoryCache); ok { go bridge.runCleanup() } - logger.Fatal(http.ListenAndServe(cfg.HTTPAddress, mux)) + logger.Fatal(httpServer.ListenAndServe()) }