feat(router): 根据环境配置有条件启用Swagger文档
- 新增env参数用于路由初始化 - 仅当环境非生产时启用Swagger文档访问 - 通过传递环境配置参数控制文档路由注册 - 修改router构造函数和调用处以支持新参数
This commit is contained in:
+1
-1
@@ -105,7 +105,7 @@ func main() {
|
||||
zap.String("region", cfg.S3.Region),
|
||||
)
|
||||
|
||||
engine := router.New(log, db, searchClient, rdb, cfg.Equalize, s3Storage, cfg.ShareCodeMaxPerMac, time.Duration(cfg.ShareCodeTTLMin)*time.Minute)
|
||||
engine := router.New(log, db, searchClient, rdb, cfg.Equalize, s3Storage, cfg.ShareCodeMaxPerMac, time.Duration(cfg.ShareCodeTTLMin)*time.Minute, cfg.Env)
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: cfg.Addr(),
|
||||
|
||||
Reference in New Issue
Block a user