|
@@ -62,8 +62,8 @@ type config struct {
|
|
Bind string
|
|
Bind string
|
|
ReadTimeout int
|
|
ReadTimeout int
|
|
WriteTimeout int
|
|
WriteTimeout int
|
|
-
|
|
|
|
- TTL int
|
|
|
|
|
|
+ Concurrency int
|
|
|
|
+ TTL int
|
|
|
|
|
|
MaxSrcDimension int
|
|
MaxSrcDimension int
|
|
|
|
|
|
@@ -80,6 +80,7 @@ var conf = config{
|
|
Bind: ":8080",
|
|
Bind: ":8080",
|
|
ReadTimeout: 10,
|
|
ReadTimeout: 10,
|
|
WriteTimeout: 10,
|
|
WriteTimeout: 10,
|
|
|
|
+ Concurrency: 100,
|
|
TTL: 3600,
|
|
TTL: 3600,
|
|
MaxSrcDimension: 4096,
|
|
MaxSrcDimension: 4096,
|
|
Quality: 80,
|
|
Quality: 80,
|
|
@@ -94,6 +95,7 @@ func init() {
|
|
strEnvConfig(&conf.Bind, "IMGPROXY_BIND")
|
|
strEnvConfig(&conf.Bind, "IMGPROXY_BIND")
|
|
intEnvConfig(&conf.ReadTimeout, "IMGPROXY_READ_TIMEOUT")
|
|
intEnvConfig(&conf.ReadTimeout, "IMGPROXY_READ_TIMEOUT")
|
|
intEnvConfig(&conf.WriteTimeout, "IMGPROXY_WRITE_TIMEOUT")
|
|
intEnvConfig(&conf.WriteTimeout, "IMGPROXY_WRITE_TIMEOUT")
|
|
|
|
+ intEnvConfig(&conf.Concurrency, "IMGPROXY_CONCURRENCY")
|
|
|
|
|
|
intEnvConfig(&conf.TTL, "IMGPROXY_TTL")
|
|
intEnvConfig(&conf.TTL, "IMGPROXY_TTL")
|
|
|
|
|
|
@@ -129,6 +131,10 @@ func init() {
|
|
log.Fatalf("Write timeout should be greater than 0, now - %d\n", conf.WriteTimeout)
|
|
log.Fatalf("Write timeout should be greater than 0, now - %d\n", conf.WriteTimeout)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if conf.Concurrency <= 0 {
|
|
|
|
+ log.Fatalf("Concurrency should be greater than 0, now - %d\n", conf.Concurrency)
|
|
|
|
+ }
|
|
|
|
+
|
|
if conf.TTL <= 0 {
|
|
if conf.TTL <= 0 {
|
|
log.Fatalf("TTL should be greater than 0, now - %d\n", conf.TTL)
|
|
log.Fatalf("TTL should be greater than 0, now - %d\n", conf.TTL)
|
|
}
|
|
}
|