-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (46 loc) · 922 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"os"
"github.com/urfave/cli"
_ "github.com/ztalab/ZAManager/docs"
"github.com/ztalab/ZAManager/server"
_ "go.uber.org/automaxprocs"
)
// @title ZAManager API
// @version 1.0.0
// @description This is ZAManager api list.
// @host 127.0.0.1:80
// @BasePath /api/v1
func main() {
app := cli.NewApp()
app.Name = "ZAManager"
app.Author = "TS"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "server",
Value: "http",
Usage: "run server type: http",
},
cli.StringFlag{
Name: "c",
Value: "config.yaml",
Usage: "config file url",
},
}
app.Before = server.InitService
app.Action = func(c *cli.Context) error {
println("RunHttp Server.")
serverType := c.String("server")
switch serverType {
case "http":
server.RunHTTP()
default:
server.RunHTTP()
}
return nil
}
err := app.Run(os.Args)
if err != nil {
panic("app run error:" + err.Error())
}
}