Disable profiler on live server

This commit is contained in:
Eduard Urbach 2018-12-07 06:03:35 +09:00
parent 7dfaa85a7a
commit da716fc3aa

View File

@ -3,10 +3,14 @@ package main
import ( import (
"net/http" "net/http"
"net/http/pprof" "net/http/pprof"
"github.com/animenotifier/arn"
) )
func init() { func init() {
// Uncomment these if you want to enable live profiling via /debug/pprof if !arn.IsDevelopment() {
return
}
app.Router.HandlerFunc("GET", "/debug/pprof/", http.HandlerFunc(pprof.Index)) app.Router.HandlerFunc("GET", "/debug/pprof/", http.HandlerFunc(pprof.Index))
app.Router.HandlerFunc("GET", "/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline)) app.Router.HandlerFunc("GET", "/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))