1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-02 11:34:20 +02:00

Remove debug warnings; Update docs

This commit is contained in:
DarthSim 2019-12-25 14:49:20 +06:00
parent 70b3252373
commit 56f69c193c
4 changed files with 8 additions and 6 deletions

View File

@ -4,6 +4,7 @@
### Added ### Added
- `IMGPROXY_LOG_LEVEL` config. - `IMGPROXY_LOG_LEVEL` config.
- `max_bytes` processing option. - `max_bytes` processing option.
- `IMGPROXY_ALLOWED_SOURCES` config.
### Changed ### Changed
- Docker image base is changed to Debian 10 for better stability and performance. - Docker image base is changed to Debian 10 for better stability and performance.

View File

@ -132,8 +132,7 @@ func sourceEnvConfig(allowedsources *[]string, name string) {
sources := []string{} sources := []string{}
if env := os.Getenv(name); len(env) > 0 { if env := os.Getenv(name); len(env) > 0 {
for _, source := range strings.Split(env, ",") { for _, source := range strings.Split(env, ",") {
logWarning("source: %s", source) sources = append(sources, fmt.Sprintf("%s://", strings.TrimSpace(source)))
sources = append(sources, fmt.Sprintf("%s://", source))
} }
} }
*allowedsources = sources *allowedsources = sources
@ -287,6 +286,8 @@ func configure() {
} }
intEnvConfig(&conf.MaxAnimationFrames, "IMGPROXY_MAX_ANIMATION_FRAMES") intEnvConfig(&conf.MaxAnimationFrames, "IMGPROXY_MAX_ANIMATION_FRAMES")
sourceEnvConfig(&conf.AllowedSources, "IMGPROXY_ALLOWED_SOURCES")
boolEnvConfig(&conf.JpegProgressive, "IMGPROXY_JPEG_PROGRESSIVE") boolEnvConfig(&conf.JpegProgressive, "IMGPROXY_JPEG_PROGRESSIVE")
boolEnvConfig(&conf.PngInterlaced, "IMGPROXY_PNG_INTERLACED") boolEnvConfig(&conf.PngInterlaced, "IMGPROXY_PNG_INTERLACED")
boolEnvConfig(&conf.PngQuantize, "IMGPROXY_PNG_QUANTIZE") boolEnvConfig(&conf.PngQuantize, "IMGPROXY_PNG_QUANTIZE")
@ -318,7 +319,6 @@ func configure() {
boolEnvConfig(&conf.DevelopmentErrorsMode, "IMGPROXY_DEVELOPMENT_ERRORS_MODE") boolEnvConfig(&conf.DevelopmentErrorsMode, "IMGPROXY_DEVELOPMENT_ERRORS_MODE")
strEnvConfig(&conf.LocalFileSystemRoot, "IMGPROXY_LOCAL_FILESYSTEM_ROOT") strEnvConfig(&conf.LocalFileSystemRoot, "IMGPROXY_LOCAL_FILESYSTEM_ROOT")
sourceEnvConfig(&conf.AllowedSources, "IMGPROXY_ALLOWED_SOURCES")
boolEnvConfig(&conf.S3Enabled, "IMGPROXY_USE_S3") boolEnvConfig(&conf.S3Enabled, "IMGPROXY_USE_S3")
strEnvConfig(&conf.S3Region, "IMGPROXY_S3_REGION") strEnvConfig(&conf.S3Region, "IMGPROXY_S3_REGION")

View File

@ -63,6 +63,10 @@ When you use imgproxy in a development environment, it can be useful to ignore S
* `IMGPROXY_IGNORE_SSL_VERIFICATION`: when true, disables SSL verification, so imgproxy can be used in a development environment with self-signed SSL certificates. * `IMGPROXY_IGNORE_SSL_VERIFICATION`: when true, disables SSL verification, so imgproxy can be used in a development environment with self-signed SSL certificates.
You can limit allowed protocols of the source URLs:
* `IMGPROXY_ALLOWED_SOURCES`: when set, limits allowed source URL protocols. Example: `https,s3,local`. Default: blank.
Also you may want imgproxy to respond with the same error message that it writes to the log: Also you may want imgproxy to respond with the same error message that it writes to the log:
* `IMGPROXY_DEVELOPMENT_ERRORS_MODE`: when true, imgproxy will respond with detailed error messages. Not recommended for production because some errors may contain stack trace. * `IMGPROXY_DEVELOPMENT_ERRORS_MODE`: when true, imgproxy will respond with detailed error messages. Not recommended for production because some errors may contain stack trace.
@ -166,7 +170,6 @@ imgproxy can be switched into "presets-only mode". In this mode, imgproxy accept
imgproxy can serve your local images, but this feature is disabled by default. To enable it, specify your local filesystem root: imgproxy can serve your local images, but this feature is disabled by default. To enable it, specify your local filesystem root:
* `IMGPROXY_LOCAL_FILESYSTEM_ROOT`: the root of the local filesystem. Keep empty to disable serving of local files. * `IMGPROXY_LOCAL_FILESYSTEM_ROOT`: the root of the local filesystem. Keep empty to disable serving of local files.
* `IMGPROXY_ONLY_LOCAL_FILESYSTEM`: when true only allows images to be served from the local filesytem. Default: false;
Check out the [Serving local files](serving_local_files.md) guide to learn more. Check out the [Serving local files](serving_local_files.md) guide to learn more.

View File

@ -795,11 +795,9 @@ func applyProcessingOptions(po *processingOptions, options urlOptions) error {
func isAllowedSource(imageURL string) bool { func isAllowedSource(imageURL string) bool {
logWarning("URL: %s", imageURL) logWarning("URL: %s", imageURL)
if len(conf.AllowedSources) == 0 { if len(conf.AllowedSources) == 0 {
logWarning("No sources set")
return true return true
} }
for _, val := range conf.AllowedSources { for _, val := range conf.AllowedSources {
logWarning("Allowed Source: %s", string(val))
if strings.HasPrefix(imageURL, string(val)) { if strings.HasPrefix(imageURL, string(val)) {
return true return true
} }