-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.go
38 lines (36 loc) · 877 Bytes
/
cli.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
package main
import "github.com/urfave/cli"
func configureCli() (app *cli.App) {
app = cli.NewApp()
app.Usage = "Babl Quality Assurance"
app.Version = Version
app.Action = func(c *cli.Context) {
httpServerBind := c.String("listen")
kafkaBrokers := c.String("kafka-brokers")
if len(httpServerBind) == 0 {
httpServerBind = ":8888"
}
if len(kafkaBrokers) == 0 {
kafkaBrokers = "queue.babl.sh:9092"
}
run(httpServerBind, kafkaBrokers, c.GlobalBool("debug"))
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "listen, l",
Usage: "Host & port to listen to",
Value: ":8888",
},
cli.StringFlag{
Name: "kafka-brokers, kb",
Usage: "Comma separated list of kafka brokers",
Value: "queue.babl.sh:9092",
},
cli.BoolFlag{
Name: "debug",
Usage: "Enable debug mode & verbose logging",
EnvVar: "BABL_DEBUG",
},
}
return
}