forked from fwtpe/owl-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 847 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
package main
import (
"fmt"
"os"
"syscall"
"github.com/fwtpe/owl-backend/common/logruslog"
oos "github.com/fwtpe/owl-backend/common/os"
"github.com/fwtpe/owl-backend/common/vipercfg"
"github.com/fwtpe/owl-backend/modules/hbs/g"
"github.com/fwtpe/owl-backend/modules/hbs/http"
"github.com/fwtpe/owl-backend/modules/hbs/rpc"
"github.com/fwtpe/owl-backend/modules/hbs/service"
)
func main() {
vipercfg.Parse()
vipercfg.Bind()
if vipercfg.Config().GetBool("version") {
fmt.Println(g.VERSION)
os.Exit(0)
}
vipercfg.Load()
g.ParseConfig(vipercfg.Config().GetString("config"))
logruslog.Init()
service.InitPackage(vipercfg.Config())
rpc.InitPackage(vipercfg.Config())
go http.Start()
go rpc.Start()
oos.HoldingAndWaitSignal(
func(signal os.Signal) {
rpc.Stop()
},
os.Interrupt, os.Kill,
syscall.SIGTERM,
)
}