From 8f140dda9fb752c6ba8ff98aa4fa703cbe0e3d90 Mon Sep 17 00:00:00 2001 From: James Renken Date: Fri, 22 Nov 2024 17:55:37 -0800 Subject: [PATCH] cmd: Make debug address optional --- cmd/shell.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/shell.go b/cmd/shell.go index 5a8378c6a53..6ae3e929700 100644 --- a/cmd/shell.go +++ b/cmd/shell.go @@ -288,23 +288,23 @@ func newStatsRegistry(addr string, logger blog.Logger) prometheus.Registerer { })) if addr == "" { - logger.Err("Debug listen address is not configured") - os.Exit(1) - } - logger.Infof("Debug server listening on %s", addr) + logger.Infof("No debug server specified") + } else { + logger.Infof("Debug server listening on %s", addr) - server := http.Server{ - Addr: addr, - Handler: mux, - ReadTimeout: time.Minute, - } - go func() { - err := server.ListenAndServe() - if err != nil { - logger.Errf("unable to boot debug server on %s: %v", addr, err) - os.Exit(1) + server := http.Server{ + Addr: addr, + Handler: mux, + ReadTimeout: time.Minute, } - }() + go func() { + err := server.ListenAndServe() + if err != nil { + logger.Errf("unable to boot debug server on %s: %v", addr, err) + os.Exit(1) + } + }() + } return registry }