Commit dd3c85be authored by Eric Tune's avatar Eric Tune

Use https when Insecure is selected.

parent 9f275069
...@@ -231,7 +231,7 @@ func IsConfigTransportSecure(config *Config) bool { ...@@ -231,7 +231,7 @@ func IsConfigTransportSecure(config *Config) bool {
func defaultServerUrlFor(config *Config) (*url.URL, error) { func defaultServerUrlFor(config *Config) (*url.URL, error) {
version := defaultVersionFor(config) version := defaultVersionFor(config)
// TODO: move the default to secure when the apiserver supports TLS by default // TODO: move the default to secure when the apiserver supports TLS by default
defaultSecure := config.CertFile != "" defaultSecure := config.CertFile != "" || config.Insecure
host := config.Host host := config.Host
if host == "" { if host == "" {
host = "localhost" host = "localhost"
......
...@@ -76,6 +76,13 @@ func TestIsConfigTransportSecure(t *testing.T) { ...@@ -76,6 +76,13 @@ func TestIsConfigTransportSecure(t *testing.T) {
}, },
Secure: false, Secure: false,
}, },
{
Config: &Config{
Host: "1.2.3.4:567",
Insecure: true,
},
Secure: true,
},
} }
for _, testCase := range testCases { for _, testCase := range testCases {
secure := IsConfigTransportSecure(testCase.Config) secure := IsConfigTransportSecure(testCase.Config)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment