main.go 420 B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "os"
  4. "os/signal"
  5. "net/http"
  6. _ "net/http/pprof"
  7. )
  8. const version = "2.1.0.rc1"
  9. type ctxKey string
  10. func main() {
  11. if len(os.Getenv("IMGPROXY_PPROF_BIND")) > 0 {
  12. go func() {
  13. http.ListenAndServe(os.Getenv("IMGPROXY_PPROF_BIND"), nil)
  14. }()
  15. }
  16. s := startServer()
  17. stop := make(chan os.Signal, 1)
  18. signal.Notify(stop, os.Interrupt, os.Kill)
  19. <-stop
  20. shutdownServer(s)
  21. shutdownVips()
  22. }