Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VAULT_TLS_SERVER_NAME environment variable #1131

Merged
merged 1 commit into from Feb 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/client.go
Expand Up @@ -25,6 +25,7 @@ const EnvVaultCAPath = "VAULT_CAPATH"
const EnvVaultClientCert = "VAULT_CLIENT_CERT"
const EnvVaultClientKey = "VAULT_CLIENT_KEY"
const EnvVaultInsecure = "VAULT_SKIP_VERIFY"
const EnvVaultTLSServerName = "VAULT_TLS_SERVER_NAME"

var (
errRedirect = errors.New("redirect")
Expand Down Expand Up @@ -81,6 +82,7 @@ func (c *Config) ReadEnvironment() error {
var envClientKey string
var envInsecure bool
var foundInsecure bool
var envTLSServerName string

var newCertPool *x509.CertPool
var clientCert tls.Certificate
Expand Down Expand Up @@ -109,6 +111,9 @@ func (c *Config) ReadEnvironment() error {
}
foundInsecure = true
}
if v := os.Getenv(EnvVaultTLSServerName); v != "" {
envTLSServerName = v
}
// If we need custom TLS configuration, then set it
if envCACert != "" || envCAPath != "" || envClientCert != "" || envClientKey != "" || envInsecure {
var err error
Expand Down Expand Up @@ -146,6 +151,9 @@ func (c *Config) ReadEnvironment() error {
if foundClientCert {
clientTLSConfig.Certificates = []tls.Certificate{clientCert}
}
if envTLSServerName != "" {
clientTLSConfig.ServerName = envTLSServerName
}

return nil
}
Expand Down