Commit c54097d9 authored by Clayton Coleman's avatar Clayton Coleman

DefaultMux should only register the first time

parent 1f628f23
......@@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"net/http"
"sync"
)
// HealthzChecker is a named healthz check.
......@@ -28,9 +29,13 @@ type HealthzChecker interface {
Check(req *http.Request) error
}
var defaultHealthz = sync.Once{}
// DefaultHealthz installs the default healthz check to the http.DefaultServeMux.
func DefaultHealthz(checks ...HealthzChecker) {
defaultHealthz.Do(func() {
InstallHandler(http.DefaultServeMux, checks...)
})
}
// PingHealthz returns true automatically when checked
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment