start server in separator go routine
This commit is contained in:
parent
b680ac3460
commit
624131f03e
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user