|
|
|
@ -406,22 +406,24 @@ func SetupTLSConfig(tlsConfig *TLSConfig) (*tls.Config, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *Config) GenerateEnv() []string {
|
|
|
|
|
env := make([]string, 10)
|
|
|
|
|
env := make([]string, 0, 10)
|
|
|
|
|
|
|
|
|
|
env = append(env,
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPAddrEnvName, c.Address),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPTokenEnvName, c.Token),
|
|
|
|
|
fmt.Sprintf("%s=%t", HTTPSSLEnvName, c.Scheme == "https"),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPCAFile, c.TLSConfig.CAFile),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPCAPath, c.TLSConfig.CAPath),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPClientCert, c.TLSConfig.CertFile),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPClientKey, c.TLSConfig.KeyFile),
|
|
|
|
|
fmt.Sprintf("%s=%s", HTTPTLSServerName, c.TLSConfig.Address),
|
|
|
|
|
fmt.Sprintf("%s=%t", HTTPSSLVerifyEnvName, !c.TLSConfig.InsecureSkipVerify))
|
|
|
|
|
|
|
|
|
|
env[0] = fmt.Sprintf("%s=%s", HTTPAddrEnvName, c.Address)
|
|
|
|
|
env[1] = fmt.Sprintf("%s=%s", HTTPTokenEnvName, c.Token)
|
|
|
|
|
if c.HttpAuth != nil {
|
|
|
|
|
env[2] = fmt.Sprintf("%s=%s:%s", HTTPAuthEnvName, c.HttpAuth.Username, c.HttpAuth.Password)
|
|
|
|
|
env = append(env, fmt.Sprintf("%s=%s:%s", HTTPAuthEnvName, c.HttpAuth.Username, c.HttpAuth.Password))
|
|
|
|
|
} else {
|
|
|
|
|
env[2] = fmt.Sprintf("%s=", HTTPAuthEnvName)
|
|
|
|
|
}
|
|
|
|
|
env[3] = fmt.Sprintf("%s=%t", HTTPSSLEnvName, c.Scheme == "https")
|
|
|
|
|
env[4] = fmt.Sprintf("%s=%s", HTTPCAFile, c.TLSConfig.CAFile)
|
|
|
|
|
env[5] = fmt.Sprintf("%s=%s", HTTPCAPath, c.TLSConfig.CAPath)
|
|
|
|
|
env[6] = fmt.Sprintf("%s=%s", HTTPClientCert, c.TLSConfig.CertFile)
|
|
|
|
|
env[7] = fmt.Sprintf("%s=%s", HTTPClientKey, c.TLSConfig.KeyFile)
|
|
|
|
|
env[8] = fmt.Sprintf("%s=%s", HTTPTLSServerName, c.TLSConfig.Address)
|
|
|
|
|
env[9] = fmt.Sprintf("%s=%t", HTTPSSLVerifyEnvName, !c.TLSConfig.InsecureSkipVerify)
|
|
|
|
|
env = append(env, fmt.Sprintf("%s=", HTTPAuthEnvName))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return env
|
|
|
|
|
}
|
|
|
|
|