feat(gin.Mode()): 由环境变量决定,不再依赖于配置文件system.Env (#1668)
* feat(gin.Mode()): 由环境变量决定,不再依赖于配置文件system.Env * feat(casbin):不需要判断是否是debug模式,都要附带参数 * feat(前端配置):去掉环境之的配置
This commit is contained in:
@@ -33,15 +33,9 @@ func (fs justFilesFilesystem) Open(name string) (http.File, error) {
|
||||
// 初始化总路由
|
||||
|
||||
func Routers() *gin.Engine {
|
||||
|
||||
// 设置为发布模式
|
||||
if global.GVA_CONFIG.System.Env == "public" {
|
||||
gin.SetMode(gin.ReleaseMode) //DebugMode ReleaseMode TestMode
|
||||
}
|
||||
|
||||
Router := gin.New()
|
||||
Router.Use(gin.Recovery())
|
||||
if global.GVA_CONFIG.System.Env != "public" {
|
||||
if gin.Mode() == gin.DebugMode {
|
||||
Router.Use(gin.Logger())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user