forked from open-falcon-archive/fe
-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
50 lines (43 loc) · 840 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 (
"flag"
"fmt"
"github.com/Cepave/fe/cache"
"github.com/Cepave/fe/g"
"github.com/Cepave/fe/graph"
"github.com/Cepave/fe/grpc"
"github.com/Cepave/fe/http"
"github.com/Cepave/fe/model"
"github.com/Cepave/fe/mq"
"github.com/toolkits/logger"
"log"
"os"
)
func main() {
cfg := flag.String("c", "cfg.json", "configuration file")
version := flag.Bool("v", false, "show version")
flag.Parse()
if *version {
fmt.Println(g.VERSION)
os.Exit(0)
}
// parse config
if err := g.ParseConfig(*cfg); err != nil {
log.Fatalln(err)
}
conf := g.Config()
logger.SetLevelWithDefault(g.Config().Log, "info")
model.InitDatabase()
cache.InitCache()
if conf.Grpc.Enabled {
graph.Start()
go grpc.Start()
}
if conf.Mq.Enabled {
go mq.Start()
}
if conf.Http.Enabled {
go http.Start()
}
select {}
}