Fix -nohealthz flag

I imagined the behavior that prefixing a bool flag with "no" turns it
off...

git-svn-id: file:///srv/svn/repo/toyohime/trunk@94 922d331f-388e-da47-97a9-ad700dc0b8b9
This commit is contained in:
jonbetti 2018-06-06 16:41:38 +00:00
parent faf6868364
commit fae46b3e21

View File

@ -40,7 +40,7 @@ import (
var (
showIndex = flag.Bool("index", false, "Show a list of repos at /")
exposeHealthz = flag.Bool("healthz", true, "Expose a healthz endpoint at /healthz")
noHealthz = flag.Bool("nohealthz", false, "Disable healthcheck endpoint at /healthz")
)
var host string
@ -144,7 +144,7 @@ func registerHealthz(mux *http.ServeMux) {
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "usage: %s fqdn [repos file]", os.Args[0])
fmt.Fprintf(os.Stderr, "usage: %s fqdn [repos file]\n", os.Args[0])
flag.PrintDefaults()
}
flag.Parse()
@ -168,7 +168,7 @@ func main() {
buildMux(mux, f)
}
if *exposeHealthz {
if !*noHealthz {
registerHealthz(mux)
}