1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-07-12 23:00:55 +02:00

More reasonable defaults

This commit is contained in:
DarthSim
2017-09-28 23:17:23 +06:00
parent 6d840c7cb6
commit 816f6a8e07
2 changed files with 5 additions and 4 deletions

View File

@ -135,8 +135,8 @@ $ xxd -g 2 -l 64 -p /dev/random | tr -d '\n'
* `IMGPROXY_READ_TIMEOUT` — the maximum duration (in seconds) for reading the entire image request, including the body. Default: `10`; * `IMGPROXY_READ_TIMEOUT` — the maximum duration (in seconds) for reading the entire image request, including the body. Default: `10`;
* `IMGPROXY_WRITE_TIMEOUT` — the maximum duration (in seconds) for writing the response. Default: `10`; * `IMGPROXY_WRITE_TIMEOUT` — the maximum duration (in seconds) for writing the response. Default: `10`;
* `IMGPROXY_DOWNLOAD_TIMEOUT` — the maximum duration (in seconds) for downloading the source image. Default: `5`; * `IMGPROXY_DOWNLOAD_TIMEOUT` — the maximum duration (in seconds) for downloading the source image. Default: `5`;
* `IMGPROXY_CONCURRENCY` — the maximum number of image requests to be processed simultaneously. Default: `100`; * `IMGPROXY_CONCURRENCY` — the maximum number of image requests to be processed simultaneously. Default: double number of CPU cores;
* `IMGPROXY_MAX_CLIENTS` — the maximum number of simultaneous active connections. Default: `IMGPROXY_CONCURRENCY * 2`; * `IMGPROXY_MAX_CLIENTS` — the maximum number of simultaneous active connections. Default: `IMGPROXY_CONCURRENCY * 5`;
#### Security #### Security

View File

@ -7,6 +7,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"runtime"
"strconv" "strconv"
) )
@ -83,7 +84,7 @@ var conf = config{
ReadTimeout: 10, ReadTimeout: 10,
WriteTimeout: 10, WriteTimeout: 10,
DownloadTimeout: 5, DownloadTimeout: 5,
Concurrency: 100, Concurrency: runtime.NumCPU() * 2,
TTL: 3600, TTL: 3600,
MaxSrcDimension: 4096, MaxSrcDimension: 4096,
Quality: 80, Quality: 80,
@ -145,7 +146,7 @@ func init() {
} }
if conf.MaxClients <= 0 { if conf.MaxClients <= 0 {
conf.MaxClients = conf.Concurrency * 2 conf.MaxClients = conf.Concurrency * 5
} }
if conf.TTL <= 0 { if conf.TTL <= 0 {