-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.go
43 lines (37 loc) · 822 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
package main
import (
"log"
"math/rand"
"os"
"time"
"github.com/urfave/cli/v2"
"github.com/websentry/websentry/server"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Value: "config.json",
Usage: "Load configuration from `FILE`",
},
},
Action: start,
Usage: "master server for websentry",
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
func start(c *cli.Context) error {
// TODO: Calling Init of each module manually is not a good idea.
// It's very easy to miss something or initializing in a wrong order.
// It's better to avoid using singleton and pass things around.
err := server.Init(c.String("config"))
return err
}