From d77147f7cf87f637f4ca8034156bc3d66e3b1643 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 11 Feb 2021 00:13:47 +0100 Subject: [PATCH] refactor: fix router variable name Signed-off-by: Mark Sagi-Kazar --- cmd/dex/serve.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/dex/serve.go b/cmd/dex/serve.go index 469f1e13..fd07a09a 100644 --- a/cmd/dex/serve.go +++ b/cmd/dex/serve.go @@ -325,20 +325,20 @@ func runServe(options serveOptions) error { return fmt.Errorf("failed to initialize server: %v", err) } - telemetryServ := http.NewServeMux() - telemetryServ.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{})) + telemetryRouter := http.NewServeMux() + telemetryRouter.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{})) // Configure health checker healthChecker := gosundheit.New() { handler := gosundheithttp.HandleHealthJSON(healthChecker) - telemetryServ.Handle("/healthz", handler) + telemetryRouter.Handle("/healthz", handler) // Kubernetes style health checks - telemetryServ.HandleFunc("/healthz/live", func(w http.ResponseWriter, _ *http.Request) { + telemetryRouter.HandleFunc("/healthz/live", func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte("ok")) }) - telemetryServ.Handle("/healthz/ready", handler) + telemetryRouter.Handle("/healthz/ready", handler) } healthChecker.RegisterCheck(&gosundheit.Config{ @@ -352,7 +352,7 @@ func runServe(options serveOptions) error { var gr run.Group if c.Telemetry.HTTP != "" { - telemetrySrv := &http.Server{Addr: c.Telemetry.HTTP, Handler: telemetryServ} + telemetrySrv := &http.Server{Addr: c.Telemetry.HTTP, Handler: telemetryRouter} defer telemetrySrv.Close() if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil {