forked from amidaware/tacticalrmm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (36 loc) · 751 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
package main
// env CGO_ENABLED=0 go build -ldflags "-s -w" -o nats-api
import (
"flag"
"fmt"
"runtime/debug"
"github.com/amidaware/tacticalrmm/natsapi"
"github.com/sirupsen/logrus"
)
var (
version = "3.5.6"
log = logrus.New()
)
func main() {
ver := flag.Bool("version", false, "Prints version")
cfg := flag.String("config", "", "Path to config file")
logLevel := flag.String("log", "INFO", "The log level")
flag.Parse()
if *ver {
fmt.Println(version)
bi, ok := debug.ReadBuildInfo()
if ok {
fmt.Println(bi.String())
}
return
}
setupLogging(logLevel)
api.Svc(log, *cfg)
}
func setupLogging(level *string) {
ll, err := logrus.ParseLevel(*level)
if err != nil {
ll = logrus.InfoLevel
}
log.SetLevel(ll)
}