1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

feat: 系统增加level配置项

This commit is contained in:
zhengkunwang223 2022-08-17 15:01:56 +08:00
parent 721e87cb54
commit 16727105c4
4 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
system: system:
port: 9999 port: 9999
db_type: mysql db_type: mysql
level: debug
jwt: jwt:
header_name: Authorization header_name: Authorization

View File

@ -3,4 +3,5 @@ package configs
type System struct { type System struct {
Port int `mapstructure:"port"` Port int `mapstructure:"port"`
DbType string `mapstructure:"db_type"` DbType string `mapstructure:"db_type"`
Level string `mapstructure:"level"`
} }

View File

@ -1,8 +1,6 @@
package router package router
import ( import (
"html/template"
"github.com/1Panel-dev/1Panel/docs" "github.com/1Panel-dev/1Panel/docs"
"github.com/1Panel-dev/1Panel/i18n" "github.com/1Panel-dev/1Panel/i18n"
"github.com/1Panel-dev/1Panel/middleware" "github.com/1Panel-dev/1Panel/middleware"
@ -11,6 +9,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files" swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger" ginSwagger "github.com/swaggo/gin-swagger"
"html/template"
) )
func Routers() *gin.Engine { func Routers() *gin.Engine {

View File

@ -31,6 +31,8 @@ func Start() {
cache.Init() cache.Init()
session.Init() session.Init()
binary.StartTTY() binary.StartTTY()
gin.SetMode(global.CONF.System.Level)
routers := router.Routers() routers := router.Routers()
address := fmt.Sprintf(":%d", global.CONF.System.Port) address := fmt.Sprintf(":%d", global.CONF.System.Port)
s := initServer(address, routers) s := initServer(address, routers)