mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	增加edge-admin reset命令,用来清理对应的配置
This commit is contained in:
		@@ -3,6 +3,7 @@ package main
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/apps"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/configs"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/nodes"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web"
 | 
			
		||||
@@ -13,7 +14,14 @@ func main() {
 | 
			
		||||
	app := apps.NewAppCmd().
 | 
			
		||||
		Version(teaconst.Version).
 | 
			
		||||
		Product(teaconst.ProductName).
 | 
			
		||||
		Usage(teaconst.ProcessName + " [-v|start|stop|restart|service|daemon]")
 | 
			
		||||
		Usage(teaconst.ProcessName+" [-v|start|stop|restart|service|daemon|reset]").
 | 
			
		||||
		Option("-h", "show this help").
 | 
			
		||||
		Option("-v", "show version").
 | 
			
		||||
		Option("start", "start the service").
 | 
			
		||||
		Option("stop", "stop the service").
 | 
			
		||||
		Option("service", "register service into systemd").
 | 
			
		||||
		Option("daemon", "start the service with daemon").
 | 
			
		||||
		Option("reset", "reset configs")
 | 
			
		||||
 | 
			
		||||
	app.On("daemon", func() {
 | 
			
		||||
		nodes.NewAdminNode().Daemon()
 | 
			
		||||
@@ -26,6 +34,14 @@ func main() {
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("done")
 | 
			
		||||
	})
 | 
			
		||||
	app.On("reset", func() {
 | 
			
		||||
		err := configs.ResetAPIConfig()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			fmt.Println("[ERROR]reset failed: " + err.Error())
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("done")
 | 
			
		||||
	})
 | 
			
		||||
	app.Run(func() {
 | 
			
		||||
		adminNode := nodes.NewAdminNode()
 | 
			
		||||
		adminNode.Run()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user