start server in separator go routine
This commit is contained in:
parent
b680ac3460
commit
624131f03e
@ -1,6 +1,7 @@
|
|||||||
package dockerhealth
|
package dockerhealth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,7 +13,13 @@ var server = &http.Server{
|
|||||||
var Healthy bool = true
|
var Healthy bool = true
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
go func() {
|
||||||
server.ListenAndServe()
|
server.ListenAndServe()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Stop() {
|
||||||
|
server.Shutdown(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpHandler struct {
|
type httpHandler struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user