优化注册全局中间件逻辑
This commit is contained in:
@ -28,6 +28,8 @@ type serverOption struct {
|
||||
serverInfo *apiDocDefine.Info // 服务器信息
|
||||
serverList []*apiDocDefine.ServerItem // 服务器环境列表
|
||||
enablePprof bool // 启用pprof
|
||||
enableRequestInit bool // 初始化请求,生成trace_id 设置请求时间等
|
||||
enableCors bool // 启动跨域支持
|
||||
}
|
||||
|
||||
// WithSwaggerUITheme 设置swaggerUI主题
|
||||
@ -121,3 +123,25 @@ func WithPprofEnable() SetServerOptionFunc {
|
||||
so.enablePprof = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithEnableRequestInit 全局配置初始化
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:56 2025/2/22
|
||||
func WithEnableRequestInit() SetServerOptionFunc {
|
||||
return func(so *serverOption) {
|
||||
so.enableRequestInit = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithEnableCors 启用全局跨域
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:56 2025/2/22
|
||||
func WithEnableCors() SetServerOptionFunc {
|
||||
return func(so *serverOption) {
|
||||
so.enableCors = true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user