feat: 支持设置demo检查中间件
This commit is contained in:
@@ -25,6 +25,17 @@ type serverOption struct {
|
||||
loggerCfg *middleware.AccessConfig // 日志配置
|
||||
initContextData gin.HandlerFunc // 初始化一些请求数据
|
||||
rateLimitInstance abstract.IRateLimit // 服务流控实例
|
||||
demoCheck gin.HandlerFunc // demo检查
|
||||
}
|
||||
|
||||
// WithDemoCheck 设置demo检查
|
||||
func WithDemoCheck(f gin.HandlerFunc) SetServerOptionFunc {
|
||||
return func(so *serverOption) {
|
||||
if nil == f {
|
||||
return
|
||||
}
|
||||
so.demoCheck = f
|
||||
}
|
||||
}
|
||||
|
||||
// WithRateLimitInstance 设置流控实例, 配置为 nil, 代表禁用
|
||||
|
||||
Reference in New Issue
Block a user