start server in separator go routine

This commit is contained in:
Tordarus 2021-12-13 02:34:19 +01:00
parent b680ac3460
commit 624131f03e

View File

@ -1,6 +1,7 @@
package dockerhealth
import (
"context"
"net/http"
)
@ -12,7 +13,13 @@ var server = &http.Server{
var Healthy bool = true
func init() {
go func() {
server.ListenAndServe()
}()
}
func Stop() {
server.Shutdown(context.Background())
}
type httpHandler struct {