mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-16 09:36:18 +02:00
IMGPROXY_NETWORK config
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- `IMGPROXY_NETWORK` config. Allows to bind on Unix socket.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix detection of SVG starting with a comment.
|
- Fix detection of SVG starting with a comment.
|
||||||
|
|
||||||
|
@@ -145,6 +145,7 @@ func presetFileConfig(p presets, filepath string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
|
Network string
|
||||||
Bind string
|
Bind string
|
||||||
ReadTimeout int
|
ReadTimeout int
|
||||||
WriteTimeout int
|
WriteTimeout int
|
||||||
@@ -231,6 +232,7 @@ type config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var conf = config{
|
var conf = config{
|
||||||
|
Network: "tcp",
|
||||||
Bind: ":8080",
|
Bind: ":8080",
|
||||||
ReadTimeout: 10,
|
ReadTimeout: 10,
|
||||||
WriteTimeout: 10,
|
WriteTimeout: 10,
|
||||||
@@ -272,6 +274,7 @@ func configure() {
|
|||||||
conf.Bind = fmt.Sprintf(":%s", port)
|
conf.Bind = fmt.Sprintf(":%s", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strEnvConfig(&conf.Network, "IMGPROXY_NETWORK")
|
||||||
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")
|
||||||
|
@@ -26,7 +26,8 @@ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
|||||||
|
|
||||||
## Server
|
## 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_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_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`;
|
* `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_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_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_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`.
|
||||||
|
@@ -32,7 +32,7 @@ func buildRouter() *router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startServer() *http.Server {
|
func startServer() *http.Server {
|
||||||
l, err := listenReuseport("tcp", conf.Bind)
|
l, err := listenReuseport(conf.Network, conf.Bind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logFatal(err.Error())
|
logFatal(err.Error())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user