mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 04:10:27 +08:00
改进编译脚本
This commit is contained in:
@@ -3,15 +3,9 @@ package main
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/apps"
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/nodes"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web"
|
||||
"github.com/iwind/TeaGo"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
_ "github.com/iwind/TeaGo/bootstrap"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/rands"
|
||||
"github.com/iwind/TeaGo/sessions"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -21,29 +15,7 @@ func main() {
|
||||
Usage(teaconst.ProcessName + " [-v|start|stop|restart]")
|
||||
|
||||
app.Run(func() {
|
||||
// 启动管理界面
|
||||
secret := rands.String(32)
|
||||
|
||||
// 测试环境下设置一个固定的key,方便我们调试
|
||||
if Tea.IsTesting() {
|
||||
secret = "8f983f4d69b83aaa0d74b21a212f6967"
|
||||
}
|
||||
|
||||
// 启动API节点
|
||||
_, err := os.Stat(Tea.Root + "/edge-api/configs/api.yaml")
|
||||
if err == nil {
|
||||
logs.Println("start edge-api")
|
||||
err = exec.Command(Tea.Root + "/edge-api/bin/edge-api").Start()
|
||||
if err != nil {
|
||||
logs.Println("[ERROR]start edge-api failed: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
server := TeaGo.NewServer(false).
|
||||
AccessLog(false).
|
||||
EndAll().
|
||||
|
||||
Session(sessions.NewFileSessionManager(86400, secret))
|
||||
server.Start()
|
||||
adminNode := nodes.NewAdminNode()
|
||||
adminNode.Run()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user