-
Notifications
You must be signed in to change notification settings - Fork 16
/
crawler.go
48 lines (44 loc) · 1021 Bytes
/
crawler.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
package main
import (
"github.com/Qitmeer/qng/cmd/crawler/config"
"github.com/Qitmeer/qng/cmd/crawler/log"
"github.com/Qitmeer/qng/cmd/crawler/node"
"github.com/Qitmeer/qng/common/roughtime"
_ "github.com/Qitmeer/qng/database/ffldb"
_ "github.com/Qitmeer/qng/services/common"
"github.com/urfave/cli/v2"
"os"
)
func main() {
if err := crawlerNode(); err != nil {
log.Log.Error(err.Error())
os.Exit(1)
}
}
func crawlerNode() error {
n := &node.Node{}
app := &cli.App{
Name: "CrawlerNode",
Version: "V0.0.1",
Compiled: roughtime.Now(),
Authors: []*cli.Author{
&cli.Author{
Name: "Qitmeer",
},
},
Copyright: "(c) 2020 Qitmeer",
Usage: "Crawler Node",
Flags: config.AppFlags,
EnableBashCompletion: true,
Before: func(c *cli.Context) error {
return n.Init(config.Conf)
},
After: func(c *cli.Context) error {
return n.Exit()
},
Action: func(c *cli.Context) error {
return n.Run()
},
}
return app.Run(os.Args)
}