-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.go
43 lines (37 loc) · 897 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"
"github.com/astaxie/beego/logs"
"time"
)
func main() {
confFile := "./conf/app.cfg"
err := initConfig(confFile)
if err != nil {
fmt.Printf("init conf failed:%v", err)
return
}
fmt.Println("init conf success")
err = initLogs(appConf.LogFile, appConf.LogLevel)
if err != nil {
fmt.Printf("init log failed:%v", err)
return
}
fmt.Println("init logs success")
timeout := time.Duration(appConf.EtcdTimeOut) * time.Second
var etcdAddrSlice []string
etcdAddrSlice = append(etcdAddrSlice, appConf.EtcdAddr)
err = initEtcd(etcdAddrSlice, appConf.EtcdWatchKey, timeout)
if err != nil {
logs.Error("init etcd Failed:%v", err)
return
}
fmt.Println("init etcd success")
err = initKafka(appConf.KafkaAddr, appConf.ThreadNum)
if err != nil {
logs.Error("init kafka Failed:%v", err)
return
}
fmt.Println("init kafka success")
runServer()
}