@@ -21,41 +21,22 @@ const (
21
21
var (
22
22
settings helm_env.EnvSettings
23
23
DefaultHelmHome = filepath .Join (homedir .HomeDir (), ".helm" )
24
-
25
- tlsCaCertFile string // path to TLS CA certificate file
26
- tlsCertFile string // path to TLS certificate file
27
- tlsKeyFile string // path to TLS key file
28
- tlsVerify bool // enable TLS and verify remote certificates
29
- tlsEnable bool // enable TLS
30
24
)
31
25
32
26
func addCommonCmdOptions (f * flag.FlagSet ) {
33
- f .StringVar (& tlsCaCertFile , "tls-ca-cert" , tlsCaCertDefault , "path to TLS CA certificate file" )
34
- f .StringVar (& tlsCertFile , "tls-cert" , tlsCertDefault , "path to TLS certificate file" )
35
- f .StringVar (& tlsKeyFile , "tls-key" , tlsKeyDefault , "path to TLS key file" )
36
- f .BoolVar (& tlsVerify , "tls-verify" , false , "enable TLS for request and verify remote" )
37
- f .BoolVar (& tlsEnable , "tls" , false , "enable TLS for request" )
27
+ settings .AddFlagsTLS (f )
28
+ settings .InitTLS (f )
38
29
39
30
f .StringVar ((* string )(& settings .Home ), "home" , DefaultHelmHome , "location of your Helm config. Overrides $HELM_HOME" )
40
31
}
41
32
42
33
func createHelmClient () helm.Interface {
43
34
options := []helm.Option {helm .Host (os .Getenv ("TILLER_HOST" )), helm .ConnectTimeout (int64 (30 ))}
44
35
45
- if tlsVerify || tlsEnable {
46
- if tlsCaCertFile == "" {
47
- tlsCaCertFile = settings .Home .TLSCaCert ()
48
- }
49
- if tlsCertFile == "" {
50
- tlsCertFile = settings .Home .TLSCert ()
51
- }
52
- if tlsKeyFile == "" {
53
- tlsKeyFile = settings .Home .TLSKey ()
54
- }
55
-
56
- tlsopts := tlsutil.Options {KeyFile : tlsKeyFile , CertFile : tlsCertFile , InsecureSkipVerify : true }
57
- if tlsVerify {
58
- tlsopts .CaCertFile = tlsCaCertFile
36
+ if settings .TLSVerify || settings .TLSEnable {
37
+ tlsopts := tlsutil.Options {KeyFile : settings .TLSKeyFile , CertFile : settings .TLSCertFile , InsecureSkipVerify : true }
38
+ if settings .TLSVerify {
39
+ tlsopts .CaCertFile = settings .TLSCaCertFile
59
40
tlsopts .InsecureSkipVerify = false
60
41
}
61
42
@@ -72,7 +53,7 @@ func createHelmClient() helm.Interface {
72
53
}
73
54
74
55
func expandTLSPaths () {
75
- tlsCaCertFile = os .ExpandEnv (tlsCaCertFile )
76
- tlsCertFile = os .ExpandEnv (tlsCertFile )
77
- tlsKeyFile = os .ExpandEnv (tlsKeyFile )
56
+ settings . TLSCaCertFile = os .ExpandEnv (settings . TLSCaCertFile )
57
+ settings . TLSCertFile = os .ExpandEnv (settings . TLSCertFile )
58
+ settings . TLSKeyFile = os .ExpandEnv (settings . TLSKeyFile )
78
59
}
0 commit comments