Files
EdgeAdmin/cmd/edge-admin/main.go

34 lines
784 B
Go
Raw Normal View History

2020-07-22 09:59:40 +08:00
package main
import (
2021-01-12 11:49:37 +08:00
"fmt"
2020-07-22 09:59:40 +08:00
"github.com/TeaOSLab/EdgeAdmin/internal/apps"
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
2020-10-14 14:46:22 +08:00
"github.com/TeaOSLab/EdgeAdmin/internal/nodes"
2020-07-22 09:59:40 +08:00
_ "github.com/TeaOSLab/EdgeAdmin/internal/web"
_ "github.com/iwind/TeaGo/bootstrap"
)
func main() {
app := apps.NewAppCmd().
Version(teaconst.Version).
Product(teaconst.ProductName).
2021-01-12 11:49:37 +08:00
Usage(teaconst.ProcessName + " [-v|start|stop|restart|service|daemon]")
2020-07-22 09:59:40 +08:00
2021-01-12 11:49:37 +08:00
app.On("daemon", func() {
nodes.NewAdminNode().Daemon()
})
app.On("service", func() {
err := nodes.NewAdminNode().InstallSystemService()
if err != nil {
fmt.Println("[ERROR]install failed: " + err.Error())
return
2021-01-12 11:49:37 +08:00
}
fmt.Println("done")
})
2020-07-22 09:59:40 +08:00
app.Run(func() {
2020-10-14 14:46:22 +08:00
adminNode := nodes.NewAdminNode()
adminNode.Run()
2020-07-22 09:59:40 +08:00
})
}