forked from lileio/lile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.go
41 lines (34 loc) · 781 Bytes
/
cmd.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
package lile
import "github.com/spf13/cobra"
// BaseCommand provides the basic flags vars for running a service
func BaseCommand(serviceName, shortDescription string) *cobra.Command {
command := &cobra.Command{
Use: serviceName,
Short: shortDescription,
}
command.PersistentFlags().StringVar(
&service.Config.Host,
"grpc-host",
"0.0.0.0",
"gRPC service hostname",
)
command.PersistentFlags().IntVar(
&service.Config.Port,
"grpc-port",
8000,
"gRPC port",
)
command.PersistentFlags().StringVar(
&service.PrometheusConfig.Host,
"prometheus-host",
"0.0.0.0",
"Prometheus metrics hostname",
)
command.PersistentFlags().IntVar(
&service.PrometheusConfig.Port,
"prometheus-port",
9000,
"Prometheus metrics port",
)
return command
}