Skip to content
Permalink
Browse files

Require pprof build tag to enable net/pprof

  • Loading branch information...
DarthSim committed Jun 6, 2019
1 parent 3ae8591 commit 518607f2595945d3cddd5bdda6ee9d05f7d37a14
Showing with 21 additions and 9 deletions.
  1. +0 −9 main.go
  2. +21 −0 pprof.go
@@ -7,9 +7,6 @@ import (
"runtime/debug"
"syscall"
"time"

"net/http"
_ "net/http/pprof"
)

const version = "2.2.13"
@@ -43,12 +40,6 @@ func main() {
}
}()

if len(os.Getenv("IMGPROXY_PPROF_BIND")) > 0 {
go func() {
http.ListenAndServe(os.Getenv("IMGPROXY_PPROF_BIND"), nil)
}()
}

s := startServer()

stop := make(chan os.Signal, 1)
@@ -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)
}()
}

0 comments on commit 518607f

Please sign in to comment.
You can’t perform that action at this time.