Add default redirect for profiling when enabled.
This commit adds a simple 303 redirect for the root of profile server so launching it without a path automatically goes to the debug profiling page.
This commit is contained in:
parent
7846b2f4e2
commit
cc6cfdad9e
1 changed files with 3 additions and 0 deletions
3
btcd.go
3
btcd.go
|
@ -48,6 +48,9 @@ func btcdMain() error {
|
|||
go func() {
|
||||
listenAddr := net.JoinHostPort("", cfg.Profile)
|
||||
log.Infof("Profile server listening on %s", listenAddr)
|
||||
profileRedirect := http.RedirectHandler("/debug/pprof",
|
||||
http.StatusSeeOther)
|
||||
http.Handle("/", profileRedirect)
|
||||
log.Errorf("%v", http.ListenAndServe(listenAddr, nil))
|
||||
}()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue