1 Star 0 Fork 0

Stefan/go-zero

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
config.go 1.83 KB
Copy Edit Raw Blame History
Stefan authored 2025-06-11 18:20 +08:00 . fix import package
package rest
import (
"time"
"gitee.com/emmm_admin/go-zero/core/service"
)
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
KeyFile string
}
// A SignatureConf is a signature config.
SignatureConf struct {
Strict bool `json:",default=false"`
Expiry time.Duration `json:",default=1h"`
PrivateKeys []PrivateKeyConf
}
// A RestConf is a http service config.
// Why not name it as Conf, because we need to consider usage like:
// type Config struct {
// zrpc.RpcConf
// rest.RestConf
// }
// if with the name Conf, there will be two Conf inside Config.
RestConf struct {
service.ServiceConf
Host string `json:",default=0.0.0.0"`
Port int
CertFile string `json:",optional"`
KeyFile string `json:",optional"`
Verbose bool `json:",optional"`
MaxConns int `json:",default=10000"`
MaxBytes int64 `json:",default=1048576"`
// milliseconds
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
// TraceIgnorePaths is paths blacklist for trace middleware.
TraceIgnorePaths []string `json:",optional"`
}
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/stefan886/go-zero.git
git@gitee.com:stefan886/go-zero.git
stefan886
go-zero
go-zero
45236c288c2b

Search