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