feat: add middlewares config for rest (#2765)

* feat: add middlewares config for rest

* chore: disable logs in tests

* chore: enable verbose in tests
This commit is contained in:
Kevin Wan
2023-01-08 16:41:53 +08:00
committed by GitHub
parent f4502171ea
commit ade6f9ee46
5 changed files with 67 additions and 17 deletions

View File

@@ -7,6 +7,21 @@ import (
)
type (
// MiddlewaresConf is the config of middlewares.
MiddlewaresConf struct {
Trace bool `json:",default=true"`
Log bool `json:",default=true"`
Prometheus bool `json:",default=true"`
MaxConns bool `json:",default=true"`
Breaker bool `json:",default=true"`
Shedding bool `json:",default=true"`
Timeout bool `json:",default=true"`
Recover bool `json:",default=true"`
Metrics bool `json:",default=true"`
MaxBytes bool `json:",default=true"`
Gunzip bool `json:",default=true"`
}
// A PrivateKeyConf is a private key config.
PrivateKeyConf struct {
Fingerprint string
@@ -40,5 +55,7 @@ type (
Timeout int64 `json:",default=3000"`
CpuThreshold int64 `json:",default=900,range=[0:1000]"`
Signature SignatureConf `json:",optional"`
// There are default values for all the items in Middlewares.
Middlewares MiddlewaresConf
}
)