1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00

IMGPROXY_HEALTH_CHECK_PATH config

This commit is contained in:
DarthSim 2022-02-21 18:06:20 +06:00
parent 377946d5af
commit df818706c2
4 changed files with 12 additions and 1 deletions

View File

@ -5,6 +5,7 @@
- Add the `IMGPROXY_MAX_REDIRECTS` config.
- (pro) Add the `IMGPROXY_SERVER_NAME` config.
- (pro) Add the `IMGPROXY_HEALTH_CHECK_MESSAGE` config.
- Add the `IMGPROXY_HEALTH_CHECK_PATH` config.
## [3.2.2] - 2022-02-08
### Fix

View File

@ -137,6 +137,8 @@ var (
FreeMemoryInterval int
DownloadBufferSize int
BufferPoolCalibrationThreshold int
HealthCheckPath string
)
var (
@ -275,6 +277,8 @@ func Reset() {
FreeMemoryInterval = 10
DownloadBufferSize = 0
BufferPoolCalibrationThreshold = 1024
HealthCheckPath = ""
}
func Configure() error {
@ -328,6 +332,8 @@ func Configure() error {
configurators.Bool(&EnforceAvif, "IMGPROXY_ENFORCE_AVIF")
configurators.Bool(&EnableClientHints, "IMGPROXY_ENABLE_CLIENT_HINTS")
configurators.String(&HealthCheckPath, "IMGPROXY_HEALTH_CHECK_PATH")
if err := configurators.ImageTypes(&SkipProcessingFormats, "IMGPROXY_SKIP_PROCESSING_FORMATS"); err != nil {
return err
}

View File

@ -401,4 +401,5 @@ imgproxy can send logs to syslog, but this feature is disabled by default. To en
* `IMGPROXY_STRIP_METADATA`: when `true`, imgproxy will strip all metadata (EXIF, IPTC, etc.) from JPEG and WebP output images. Default: `true`
* `IMGPROXY_STRIP_COLOR_PROFILE`: when `true`, imgproxy will transform the embedded color profile (ICC) to sRGB and remove it from the image. Otherwise, imgproxy will try to keep it as is. Default: `true`
* `IMGPROXY_AUTO_ROTATE`: when `true`, imgproxy will automatically rotate images based on the EXIF Orientation parameter (if available in the image meta data). The orientation tag will be removed from the image in all cases. Default: `true`
* `IMGPROXY_HEALTH_CHECK_MESSAGE`: <i class='badge badge-pro'></i> the content of the `/health` response. Default: `imgproxy is running`
* `IMGPROXY_HEALTH_CHECK_MESSAGE`: <i class='badge badge-pro'></i> the content of the health check response. Default: `imgproxy is running`
* `IMGPROXY_HEALTH_CHECK_PATH`: an additional path of the health check. Default: blank

View File

@ -29,6 +29,9 @@ func buildRouter() *router.Router {
r.GET("/", handleLanding, true)
r.GET("/health", handleHealth, true)
if len(config.HealthCheckPath) > 0 {
r.GET(config.HealthCheckPath, handleHealth, true)
}
r.GET("/favicon.ico", handleFavicon, true)
r.GET("/", withMetrics(withPanicHandler(withCORS(withSecret(handleProcessing)))), false)
r.HEAD("/", withCORS(handleHead), false)