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:
Dave Collins 2013-10-23 09:39:02 -05:00
parent 7846b2f4e2
commit cc6cfdad9e

View file

@ -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))
}()
}