Require pprof build tag to enable net/pprof

This commit is contained in:
DarthSim
2019-06-06 19:39:16 +06:00
parent 3ae859162f
commit 518607f259
2 changed files with 21 additions and 9 deletions

21
pprof.go Normal file
View File

@@ -0,0 +1,21 @@
// +build pprof
package main
import (
"net/http"
_ "net/http/pprof"
"os"
)
func init() {
bind := os.Getenv("IMGPROXY_PPROF_BIND")
if len(bind) == 0 {
bind = ":8088"
}
go func() {
http.ListenAndServe(bind, nil)
}()
}