-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (40 loc) · 889 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
51
package main
import (
"os"
"github.com/codemodus/sigmon/v2"
"github.com/sirupsen/logrus"
)
func main() {
// wire into system signals and ignore during startup
sm := sigmon.New(nil)
sm.Start()
// setup logging and main circuit breaker
var l Logger = logrus.New()
cs := newComs()
trip := tripFn(cs, l)
_ = trip
// load config
cnf, err := NewConf("config.cnf")
if err != nil {
if err == errFlagParse {
os.Exit(1)
}
trip(err)
}
// act on config vals
if !cnf.Main.verbose {
l = &voidLog{}
}
width := runWidth(cnf.Main.rsrvd, cnf.Main.conc)
// configure shutdown sequence
sm.Set(func(s *sigmon.State) {
cs.close()
})
trip(
runReplication(cs, l, width, cnf.Repl),
)
// disconnect from system signals
sm.Stop()
// TODO: add flag(s) to restrict message handling to span (i.e. "after", "before")
// TODO: add sub-command for duplicate removal
}