Skip to content

Commit c1bb0df

Browse files
committed
client can use env
1 parent b590893 commit c1bb0df

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

cmd/proxy-client/main.go

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,56 @@ import (
1515

1616
var flags []cli.Flag = []cli.Flag{
1717
&cli.StringFlag{
18-
Name: "listen-addr",
19-
Value: "127.0.0.1:8080",
20-
Usage: "address to listen on",
18+
Name: "listen-addr",
19+
EnvVars: []string{"LISTEN_ADDR"},
20+
Value: "127.0.0.1:8080",
21+
Usage: "address to listen on",
2122
},
2223
&cli.StringFlag{
23-
Name: "target-addr",
24-
Value: "https://localhost:80",
25-
Usage: "address to proxy requests to",
24+
Name: "target-addr",
25+
EnvVars: []string{"TARGET_ADDR"},
26+
Value: "https://localhost:80",
27+
Usage: "address to proxy requests to",
2628
},
2729
&cli.StringFlag{
28-
Name: "server-attestation-type",
29-
Value: string(proxy.AttestationAzureTDX),
30-
Usage: "type of attestation to expect and verify (" + proxy.AvailableAttestationTypes + ")",
30+
Name: "server-attestation-type",
31+
EnvVars: []string{"SERVER_ATTESTATION_TYPE"},
32+
Value: string(proxy.AttestationAzureTDX),
33+
Usage: "type of attestation to present (" + proxy.AvailableAttestationTypes + ")",
3134
},
3235
&cli.StringFlag{
33-
Name: "server-measurements",
34-
Usage: "optional path to JSON measurements enforced on the server",
36+
Name: "server-measurements",
37+
EnvVars: []string{"SERVER_MEASUREMENTS"},
38+
Usage: "optional path to JSON measurements enforced on the server",
3539
},
3640
&cli.BoolFlag{
37-
Name: "verify-tls",
38-
Value: false,
39-
Usage: "verify server's TLS certificate instead of server's attestation. Only valid for server-attestation-type=none.",
41+
Name: "verify-tls",
42+
EnvVars: []string{"VERIFY_TLS"},
43+
Value: false,
44+
Usage: "verify server's TLS certificate instead of server's attestation. Only valid for server-attestation-type=none.",
4045
},
4146
&cli.StringFlag{
42-
Name: "tls-ca-certificate",
43-
Usage: "additional CA certificate to verify against (PEM) [default=no additional TLS certs]. Only valid with --verify-tls.",
47+
Name: "tls-ca-certificate",
48+
EnvVars: []string{"TLS_CA_CERTIFICATE"},
49+
Usage: "additional CA certificate to verify against (PEM) [default=no additional TLS certs]. Only valid with --verify-tls.",
4450
},
4551
&cli.StringFlag{
46-
Name: "client-attestation-type",
47-
Value: string(proxy.AttestationNone),
48-
Usage: "type of attestation to present (" + proxy.AvailableAttestationTypes + ")",
52+
Name: "client-attestation-type",
53+
EnvVars: []string{"CLIENT_ATTESTATION_TYPE"},
54+
Value: string(proxy.AttestationNone),
55+
Usage: "type of attestation to expect and verify (" + proxy.AvailableAttestationTypes + ")",
4956
},
5057
&cli.BoolFlag{
51-
Name: "log-json",
52-
Value: false,
53-
Usage: "log in JSON format",
58+
Name: "log-json",
59+
EnvVars: []string{"LOG_JSON"},
60+
Value: false,
61+
Usage: "log in JSON format",
5462
},
5563
&cli.BoolFlag{
56-
Name: "log-debug",
57-
Value: false,
58-
Usage: "log debug messages",
64+
Name: "log-debug",
65+
EnvVars: []string{"LOG_DEBUG"},
66+
Value: false,
67+
Usage: "log debug messages",
5968
},
6069
}
6170

0 commit comments

Comments
 (0)