-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (41 loc) · 1000 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
50
package main
import (
"log"
"os"
"runtime"
"github.com/urfave/cli/v2"
"github.com/TestardR/geo-tracking/cmd"
"github.com/TestardR/geo-tracking/config"
)
var version = "develop"
func main() {
consoleOutput := log.New(os.Stdout, "", log.LstdFlags)
consoleOutput.Printf("Available processors: %d", runtime.NumCPU())
consoleOutput.Printf("GoMaxProcs: %d", runtime.GOMAXPROCS(0))
cfg, err := config.NewConfig()
if err != nil {
consoleOutput.Fatal(err)
}
appCfg, err := config.NewApplication()
if err != nil {
consoleOutput.Fatal(err)
}
app := &cli.App{
Name: "geo-tracking",
Usage: "CLI application for managing GT services",
Commands: []*cli.Command{
{
Name: "http-server",
Usage: "Starts driver status HTTP server",
Aliases: []string{"s"},
Action: func(c *cli.Context) error {
return cmd.RunAsHTTPServer(c, version, cfg, appCfg, consoleOutput)
},
},
},
}
err = app.Run(os.Args)
if err != nil {
consoleOutput.Fatal(err)
}
}