forked from hootrhino/rulex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (41 loc) · 823 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
package main
import (
"os"
"rulex/core"
"rulex/engine"
"rulex/utils"
"github.com/ngaut/log"
"github.com/urfave/cli/v2"
)
//
//go:generate ./gen_version.sh
//go:generate ./gen_proto.sh
//
func main() {
core.InitGlobalConfig()
app := &cli.App{
Name: "RULEX, a lightweight iot data rule gateway",
Usage: "http://rulex.ezlinker.cn",
Commands: []*cli.Command{
{
Name: "run",
Usage: "rulex run [path of 'rulex.db']",
Action: func(c *cli.Context) error {
utils.ShowBanner()
if c.Args().Len() > 0 {
log.Info("Use config db:", c.Args().Get(0))
engine.RunRulex(c.Args().Get(0))
} else {
engine.RunRulex("rulex.db")
}
log.Debug("Run rulex successfully.")
return nil
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}