mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-28 20:43:54 +02:00
Option to use truncated signature (#88)
* CircleCI * Fix docs resize_type -> resizing_type (#91) As noted in my issue... * Option to use truncated signature * Don't use 0 as no-limit for SignatureSize
This commit is contained in:
committed by
Sergey Alexandrovich
parent
7f5f312dfc
commit
7aae98e087
@@ -135,6 +135,7 @@ type config struct {
|
||||
Key []byte
|
||||
Salt []byte
|
||||
AllowInsecure bool
|
||||
SignatureSize int
|
||||
|
||||
Secret string
|
||||
|
||||
@@ -176,6 +177,7 @@ var conf = config{
|
||||
MaxSrcDimension: 8192,
|
||||
MaxSrcResolution: 16800000,
|
||||
AllowInsecure: false,
|
||||
SignatureSize: 32,
|
||||
Quality: 80,
|
||||
GZipCompression: 5,
|
||||
UserAgent: fmt.Sprintf("imgproxy/%s", version),
|
||||
@@ -222,6 +224,7 @@ func init() {
|
||||
|
||||
hexEnvConfig(&conf.Key, "IMGPROXY_KEY")
|
||||
hexEnvConfig(&conf.Salt, "IMGPROXY_SALT")
|
||||
intEnvConfig(&conf.SignatureSize, "IMGPROXY_SIGNATURE_SIZE")
|
||||
|
||||
hexFileConfig(&conf.Key, *keyPath)
|
||||
hexFileConfig(&conf.Salt, *saltPath)
|
||||
@@ -265,6 +268,9 @@ func init() {
|
||||
warning("Salt is not defined, so signature checking is disabled")
|
||||
conf.AllowInsecure = true
|
||||
}
|
||||
if conf.SignatureSize < 1 || conf.SignatureSize > 32 {
|
||||
log.Fatalf("Signature size should be within 1 and 32, now - %d\n", conf.SignatureSize)
|
||||
}
|
||||
|
||||
if len(conf.Bind) == 0 {
|
||||
log.Fatalln("Bind address is not defined")
|
||||
|
Reference in New Issue
Block a user