Only enables pprof when debugging is enabled

This commit is contained in:
Amir Raminfar
2021-01-20 15:54:14 -08:00
parent 5f0c384b86
commit 289d3845a8

View File

@@ -61,8 +61,13 @@ func createRouter(h *handler) *mux.Router {
s.HandleFunc("/api/logs", h.fetchLogsBetweenDates)
s.HandleFunc("/api/events/stream", h.streamEvents)
s.HandleFunc("/version", h.version)
s.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)
if log.IsLevelEnabled(log.DebugLevel) {
s.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)
}
s.PathPrefix("/").Handler(http.StripPrefix(base, http.HandlerFunc(h.index)))
return r
}