Skip to content

Commit b1af8dc

Browse files
committed
allow to configure trc with environment variable
1 parent 5d914f8 commit b1af8dc

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

cmds/client/main.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,25 @@ func main() {
2222
app.EnableBashCompletion = true
2323
app.Flags = []cli.Flag{
2424
&cli.StringFlag{
25-
Name: "secret",
26-
Usage: "secret to identify the connection",
25+
Name: "secret",
26+
Usage: "secret to identify the connection",
27+
EnvVars: []string{"TRC_SECRET"},
2728
},
2829
&cli.StringSliceFlag{
29-
Name: "remote",
30-
Usage: "address to the TCP router server, this flag can be used multiple time to connect to multiple server",
30+
Name: "remote",
31+
Usage: "address to the TCP router server, this flag can be used multiple time to connect to multiple server",
32+
EnvVars: []string{"TRC_REMOTE"},
3133
},
3234
&cli.StringFlag{
33-
Name: "local",
34-
Usage: "address to the local application",
35+
Name: "local",
36+
Usage: "address to the local application",
37+
EnvVars: []string{"TRC_LOCAL"},
3538
},
3639
&cli.IntFlag{
37-
Name: "backoff",
38-
Value: 5,
39-
Usage: "backoff in second",
40+
Name: "backoff",
41+
Value: 5,
42+
Usage: "backoff in second",
43+
EnvVars: []string{"TRC_BACKOFF"},
4044
},
4145
}
4246
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})

0 commit comments

Comments
 (0)