1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

IMGPROXY_NETWORK config

This commit is contained in:
DarthSim 2020-02-03 18:03:18 +06:00
parent 6db5b8e90b
commit 45306adc23
4 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
### Added
- `IMGPROXY_NETWORK` config. Allows to bind on Unix socket.
### Fixed
- Fix detection of SVG starting with a comment.

View File

@ -145,6 +145,7 @@ func presetFileConfig(p presets, filepath string) {
}
type config struct {
Network string
Bind string
ReadTimeout int
WriteTimeout int
@ -231,6 +232,7 @@ type config struct {
}
var conf = config{
Network: "tcp",
Bind: ":8080",
ReadTimeout: 10,
WriteTimeout: 10,
@ -272,6 +274,7 @@ func configure() {
conf.Bind = fmt.Sprintf(":%s", port)
}
strEnvConfig(&conf.Network, "IMGPROXY_NETWORK")
strEnvConfig(&conf.Bind, "IMGPROXY_BIND")
intEnvConfig(&conf.ReadTimeout, "IMGPROXY_READ_TIMEOUT")
intEnvConfig(&conf.WriteTimeout, "IMGPROXY_WRITE_TIMEOUT")

View File

@ -26,7 +26,8 @@ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
## Server
* `IMGPROXY_BIND`: TCP address and port to listen on. Default: `:8080`;
* `IMGPROXY_BIND`: address and port or Unix socket to listen on. Default: `:8080`;
* `IMGPROXY_NETWORK`: network to use. Known networks are `tcp`, `tcp4`, `tcp6`, `unix`, and `unixpacket`. Default: `tcp`;
* `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_KEEP_ALIVE_TIMEOUT`: the maximum duration (in seconds) to wait for the next request before closing the connection. When set to `0`, keep-alive is disabled. Default: `10`;
@ -253,4 +254,4 @@ imgproxy can send logs to syslog, but this feature is disabled by default. To en
* `IMGPROXY_USE_LINEAR_COLORSPACE`: when `true`, imgproxy will process images in linear colorspace. This will slow down processing. Note that images won't be fully processed in linear colorspace while shrink-on-load is enabled (see below).
* `IMGPROXY_DISABLE_SHRINK_ON_LOAD`: when `true`, disables shrink-on-load for JPEG and WebP. Allows to process the whole image in linear colorspace but dramatically slows down resizing and increases memory usage when working with large images.
* `IMGPROXY_APPLY_UNSHARPEN_MASKING`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when `true`, imgproxy will apply unsharpen masking to the resulting image if one is smaller than the source. Default: `true`.
* `IMGPROXY_STRIP_METADATA`: whether to strip all metadata (EXIF, IPTC, etc.) from JPEG and WebP output images. Default: `true`.
* `IMGPROXY_STRIP_METADATA`: whether to strip all metadata (EXIF, IPTC, etc.) from JPEG and WebP output images. Default: `true`.

View File

@ -32,7 +32,7 @@ func buildRouter() *router {
}
func startServer() *http.Server {
l, err := listenReuseport("tcp", conf.Bind)
l, err := listenReuseport(conf.Network, conf.Bind)
if err != nil {
logFatal(err.Error())
}