mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Add backwards compat support for API env vars (#7135)
Several env vars got renamed in https://github.com/hashicorp/vault/pull/6306. This re-adds support for those. Indirectly addresses https://github.com/hashicorp/consul-template/pull/1233 although they should still update to the new values.
This commit is contained in:
@@ -2,12 +2,13 @@ package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -196,6 +197,22 @@ func TestClientEnvSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientDeprecatedEnvSettings(t *testing.T) {
|
||||
oldInsecure := os.Getenv(EnvVaultInsecure)
|
||||
os.Setenv(EnvVaultInsecure, "true")
|
||||
defer os.Setenv(EnvVaultInsecure, oldInsecure)
|
||||
|
||||
config := DefaultConfig()
|
||||
if err := config.ReadEnvironment(); err != nil {
|
||||
t.Fatalf("error reading environment: %v", err)
|
||||
}
|
||||
|
||||
tlsConfig := config.HttpClient.Transport.(*http.Transport).TLSClientConfig
|
||||
if tlsConfig.InsecureSkipVerify != true {
|
||||
t.Fatalf("bad: %v", tlsConfig.InsecureSkipVerify)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientEnvNamespace(t *testing.T) {
|
||||
var seenNamespace string
|
||||
handler := func(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user