feat: support auto check upgrade (#53)

This commit is contained in:
Li4n0
2022-01-09 23:51:46 +08:00
committed by GitHub
parent 30f9069e45
commit f6afe0fa12
16 changed files with 216 additions and 32 deletions
+14
View File
@@ -42,6 +42,15 @@ func Start() {
Usage: "load configuration from FILE (default: config.yaml)",
},
},
Commands: []*cli.Command{
{
Name: "upgrade",
Action: func(c *cli.Context) error {
checkUpdateFromCli()
return nil
},
},
},
Action: func(c *cli.Context) error {
var configFile = "config.yaml"
if c.Path("config") != "" {
@@ -81,6 +90,11 @@ func Start() {
if c.String("log") != "" {
conf.LogLevel = c.String("log")
}
if conf.CheckUpgrade {
checkUpdateFromCli()
}
server.New(conf).Run()
return nil
},