-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathmain.go
53 lines (45 loc) · 1.51 KB
/
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
51
52
53
package main
import (
"context"
"flag"
"runtime/debug"
"strconv"
"github.com/didi/sharingan/replayer-agent/common/global"
"github.com/didi/sharingan/replayer-agent/common/handlers/conf"
"github.com/didi/sharingan/replayer-agent/common/handlers/httpclient"
"github.com/didi/sharingan/replayer-agent/common/handlers/httpserv"
"github.com/didi/sharingan/replayer-agent/common/handlers/ignore"
"github.com/didi/sharingan/replayer-agent/common/handlers/limit"
"github.com/didi/sharingan/replayer-agent/common/handlers/module"
"github.com/didi/sharingan/replayer-agent/common/handlers/outbound"
"github.com/didi/sharingan/replayer-agent/common/handlers/template"
"github.com/didi/sharingan/replayer-agent/common/handlers/tlog"
"github.com/didi/sharingan/replayer-agent/model/nuwaplt"
"github.com/didi/sharingan/replayer-agent/router"
)
func init() {
flag.BoolVar(&global.FlagHandler.EnableCursor, "cursor", false, "enable cursor for matching alg")
flag.IntVar(&global.FlagHandler.Parallel, "parallel", 10, "set max parallel num for replaying")
flag.Parse()
conf.Init("")
tlog.Init()
httpclient.Init()
ignore.Init()
limit.Init()
outbound.Init()
module.Init()
nuwaplt.Reload()
template.Init()
router.Init()
httpserv.Init()
}
func main() {
go func() {
defer func() {
if err := recover(); err != nil {
tlog.Handler.Errorf(context.Background(), tlog.DLTagUndefined, "panic in %s goroutine||errmsg=%s||stack info=%s", "sharingan", err, strconv.Quote(string(debug.Stack())))
}
}()
}()
httpserv.Run()
}