refactor: fix router variable name

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-02-11 00:13:47 +01:00
parent 024f69b2c7
commit d77147f7cf
No known key found for this signature in database
GPG Key ID: 34CC109EB5ED1C2A

View File

@ -325,20 +325,20 @@ func runServe(options serveOptions) error {
return fmt.Errorf("failed to initialize server: %v", err) return fmt.Errorf("failed to initialize server: %v", err)
} }
telemetryServ := http.NewServeMux() telemetryRouter := http.NewServeMux()
telemetryServ.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{})) telemetryRouter.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}))
// Configure health checker // Configure health checker
healthChecker := gosundheit.New() healthChecker := gosundheit.New()
{ {
handler := gosundheithttp.HandleHealthJSON(healthChecker) handler := gosundheithttp.HandleHealthJSON(healthChecker)
telemetryServ.Handle("/healthz", handler) telemetryRouter.Handle("/healthz", handler)
// Kubernetes style health checks // 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")) _, _ = w.Write([]byte("ok"))
}) })
telemetryServ.Handle("/healthz/ready", handler) telemetryRouter.Handle("/healthz/ready", handler)
} }
healthChecker.RegisterCheck(&gosundheit.Config{ healthChecker.RegisterCheck(&gosundheit.Config{
@ -352,7 +352,7 @@ func runServe(options serveOptions) error {
var gr run.Group var gr run.Group
if c.Telemetry.HTTP != "" { 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() defer telemetrySrv.Close()
if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil { if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil {