feat: change gin start mode (#10885)

This commit is contained in:
CityFun 2025-11-07 16:34:30 +08:00 committed by GitHub
parent f4f6f65b4c
commit 009237a35a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 7 deletions

View file

@ -4,6 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/gin-gonic/gin"
"net"
"net/http"
"os"
@ -26,7 +27,6 @@ import (
"github.com/1Panel-dev/1Panel/agent/init/validator"
"github.com/1Panel-dev/1Panel/agent/init/viper"
"github.com/1Panel-dev/1Panel/agent/utils/encrypt"
"github.com/gin-gonic/gin"
)
func Start() {
@ -40,7 +40,6 @@ func Start() {
app.Init()
lang.Init()
validator.Init()
gin.SetMode("debug")
cron.Run()
hook.Init()
InitOthers()
@ -51,6 +50,12 @@ func Start() {
Handler: rootRouter,
}
if global.CONF.Base.Mode != "stable" {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
if global.IsMaster {
_ = os.Remove("/etc/1panel/agent.sock")
_ = os.Mkdir("/etc/1panel", constant.DirPerm)

View file

@ -5,6 +5,7 @@ import (
"encoding/gob"
"fmt"
"github.com/1Panel-dev/1Panel/core/init/proxy"
"github.com/gin-gonic/gin"
"net"
"net/http"
"os"
@ -26,8 +27,6 @@ import (
"github.com/1Panel-dev/1Panel/core/init/session/psession"
"github.com/1Panel-dev/1Panel/core/init/validator"
"github.com/1Panel-dev/1Panel/core/init/viper"
"github.com/gin-gonic/gin"
)
func Start() {
@ -41,7 +40,6 @@ func Start() {
gob.Register(psession.SessionUser{})
cron.Init()
session.Init()
gin.SetMode("debug")
hook.Init()
InitOthers()
@ -50,6 +48,12 @@ func Start() {
rootRouter := router.Routers()
if global.CONF.Base.Mode != "stable" {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
tcpItem := "tcp4"
if global.CONF.Conn.Ipv6 == constant.StatusEnable {
tcpItem = "tcp"

View file

@ -112,8 +112,8 @@
class="!w-24"
>
<el-option
v-for="(unit, index) in Units"
:key="index"
v-for="(unit, indexKey) in Units"
:key="indexKey"
:label="unit.label"
:value="unit.value"
/>