File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ type ServerConfig struct {
24
24
Port int
25
25
CookieSecret string
26
26
RecoverPanic bool
27
+ Profiler bool
27
28
}
28
29
29
30
// Server represents a web.go server.
@@ -116,10 +117,12 @@ func (s *Server) Run(addr string) {
116
117
s .initServer ()
117
118
118
119
mux := http .NewServeMux ()
119
- mux .Handle ("/debug/pprof/cmdline" , http .HandlerFunc (pprof .Cmdline ))
120
- mux .Handle ("/debug/pprof/profile" , http .HandlerFunc (pprof .Profile ))
121
- mux .Handle ("/debug/pprof/heap" , pprof .Handler ("heap" ))
122
- mux .Handle ("/debug/pprof/symbol" , http .HandlerFunc (pprof .Symbol ))
120
+ if s .Config .Profiler {
121
+ mux .Handle ("/debug/pprof/cmdline" , http .HandlerFunc (pprof .Cmdline ))
122
+ mux .Handle ("/debug/pprof/profile" , http .HandlerFunc (pprof .Profile ))
123
+ mux .Handle ("/debug/pprof/heap" , pprof .Handler ("heap" ))
124
+ mux .Handle ("/debug/pprof/symbol" , http .HandlerFunc (pprof .Symbol ))
125
+ }
123
126
mux .Handle ("/" , s )
124
127
125
128
s .Logger .Printf ("web.go serving %s\n " , addr )
You can’t perform that action at this time.
0 commit comments