Skip to content

Commit

Permalink
cmd: Make debug address optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jprenken committed Nov 23, 2024
1 parent 7791262 commit 8f140dd
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 8f140dd

Please sign in to comment.