2017-06-20 15:58:55 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-10-17 14:23:48 +02:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
2018-10-05 17:17:36 +02:00
|
|
|
|
2018-10-19 12:09:01 +02:00
|
|
|
"net/http"
|
2018-10-05 17:17:36 +02:00
|
|
|
_ "net/http/pprof"
|
2017-06-20 15:58:55 +02:00
|
|
|
)
|
|
|
|
|
2018-10-30 15:41:09 +02:00
|
|
|
const version = "2.1.0.rc1"
|
2018-09-06 15:02:21 +02:00
|
|
|
|
2018-10-05 17:17:36 +02:00
|
|
|
type ctxKey string
|
|
|
|
|
2017-06-20 15:58:55 +02:00
|
|
|
func main() {
|
2018-10-19 12:09:01 +02:00
|
|
|
if len(os.Getenv("IMGPROXY_PPROF_BIND")) > 0 {
|
|
|
|
go func() {
|
|
|
|
http.ListenAndServe(os.Getenv("IMGPROXY_PPROF_BIND"), nil)
|
|
|
|
}()
|
|
|
|
}
|
|
|
|
|
2018-09-10 08:17:00 +02:00
|
|
|
s := startServer()
|
2017-06-20 15:58:55 +02:00
|
|
|
|
2017-10-17 14:23:48 +02:00
|
|
|
stop := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(stop, os.Interrupt, os.Kill)
|
2017-06-20 15:58:55 +02:00
|
|
|
|
2017-10-17 14:23:48 +02:00
|
|
|
<-stop
|
|
|
|
|
|
|
|
shutdownServer(s)
|
2018-09-10 08:17:00 +02:00
|
|
|
shutdownVips()
|
2017-06-20 15:58:55 +02:00
|
|
|
}
|