-
Notifications
You must be signed in to change notification settings - Fork 4
/
NKNDataPump.go
65 lines (52 loc) · 1.2 KB
/
NKNDataPump.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
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"github.com/nknorg/NKNDataPump/cli/commands"
"github.com/nknorg/NKNDataPump/common"
"github.com/nknorg/NKNDataPump/config"
"github.com/nknorg/NKNDataPump/network/rpcRequest"
"github.com/nknorg/NKNDataPump/server"
"github.com/nknorg/NKNDataPump/storage"
"github.com/nknorg/NKNDataPump/task/chainDataPump"
"github.com/nknorg/NKNDataPump/task/dataInspection"
"github.com/urfave/cli"
"os"
"time"
)
func getCliApp() (app *cli.App) {
app = cli.NewApp()
app.Name = "NKNDataPump"
app.Version = "0.0.1"
app.HelpName = "NKNDataPump"
app.Usage = "DNA blockchain gateway"
app.UsageText = "chainGateway [options] [args]"
app.HideHelp = false
app.HideVersion = false
return
}
func main() {
//get app
gateway := getCliApp()
//set some flags
commands.SetFlags(gateway)
commands.SetAction(gateway)
//run
err := gateway.Run(os.Args)
if nil != err {
os.Exit(-1)
}
//init logs
common.InitLog(config.PumpConfig.Logfile, config.PumpConfig.LogLevel)
//init db
storage.Init()
//set up api
rpcRequest.Api.Build()
//start data pump
chainDataPump.Start()
//start data inspection
dataInspection.Start()
//start api & web server
server.Start()
for {
time.Sleep(time.Second)
}
}