mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 12:20:28 +08:00
增加"edge-admin security.reset"命令来使用命令行重置安全设置
This commit is contained in:
@@ -41,7 +41,8 @@ func main() {
|
||||
Option("dev", "switch to 'dev' mode").
|
||||
Option("prod", "switch to 'prod' mode").
|
||||
Option("upgrade [--url=URL]", "upgrade from official site or an url").
|
||||
Option("install-local-node", "install a local node")
|
||||
Option("install-local-node", "install a local node").
|
||||
Option("security.reset", "reset security config")
|
||||
|
||||
app.On("daemon", func() {
|
||||
nodes.NewAdminNode().Daemon()
|
||||
@@ -179,6 +180,17 @@ func main() {
|
||||
log.Println("restarting ...")
|
||||
app.RunRestart()
|
||||
})
|
||||
app.On("security.reset", func() {
|
||||
var sock = gosock.NewTmpSock(teaconst.ProcessName)
|
||||
if !sock.IsListening() {
|
||||
fmt.Println("[ERROR]the service not started yet, you should start the service first")
|
||||
return
|
||||
}
|
||||
_, _ = sock.Send(&gosock.Command{
|
||||
Code: "security.reset",
|
||||
})
|
||||
fmt.Println("ok")
|
||||
})
|
||||
app.Run(func() {
|
||||
var adminNode = nodes.NewAdminNode()
|
||||
adminNode.Run()
|
||||
|
||||
Reference in New Issue
Block a user