From 0beb2decf48e6b1b8b411dc95b0ab0b253f39520 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Fri, 18 Jan 2019 09:12:22 -0800 Subject: [PATCH] Change HTTP flags This enables the HTTP endpoint by default using ":8080". In addition this adds a flag for disabling the metrics endpoint --- cmd/git-sync/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 771dbd3..419e842 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -98,7 +98,9 @@ var flGitCmd = flag.String("git", envString("GIT_SYNC_GIT", "git"), "the git command to run (subject to PATH search)") var flHTTPBind = flag.String("http-bind", envString("GIT_SYNC_HTTP_BIND", ""), - "the bind address for git-sync's HTTP endpoint") + "the bind address (including port) for git-sync's HTTP endpoint") +var flHTTPMetrics = flag.Bool("http-metrics", envBool("GIT_SYNC_HTTP_METRICS", true), + "enable metrics on git-sync's HTTP endpoint") var log = newLoggerOrDie() @@ -241,7 +243,9 @@ func main() { os.Exit(1) } go func() { - http.Handle("/metrics", promhttp.Handler()) + if *flHTTPMetrics { + http.Handle("/metrics", promhttp.Handler()) + } http.Serve(ln, http.DefaultServeMux) }() }