http: Use own server
This commit is contained in:
parent
fab51ab54b
commit
e0e1281ec3
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
@ -453,6 +453,10 @@ func main() {
|
||||||
logger.Infof("Listening on %s, ntfy-alertmanager %s", cfg.HTTPAddress, version)
|
logger.Infof("Listening on %s, ntfy-alertmanager %s", cfg.HTTPAddress, version)
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
httpServer := &http.Server{
|
||||||
|
Addr: cfg.HTTPAddress,
|
||||||
|
Handler: mux,
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.User != "" && cfg.Password != "" {
|
if cfg.User != "" && cfg.Password != "" {
|
||||||
logger.Info("Enabling HTTP Basic Authentication")
|
logger.Info("Enabling HTTP Basic Authentication")
|
||||||
|
@ -466,5 +470,5 @@ func main() {
|
||||||
if _, ok := c.(*cache.MemoryCache); ok {
|
if _, ok := c.(*cache.MemoryCache); ok {
|
||||||
go bridge.runCleanup()
|
go bridge.runCleanup()
|
||||||
}
|
}
|
||||||
logger.Fatal(http.ListenAndServe(cfg.HTTPAddress, mux))
|
logger.Fatal(httpServer.ListenAndServe())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue