From 4e886456cced73dc3fa9b2e275cb5f320310b4c8 Mon Sep 17 00:00:00 2001 From: Nick Tan Date: Thu, 14 Sep 2023 21:55:59 -0700 Subject: [PATCH] feat: add custom net/http transport to Vault provider (#232) --- providers/vault/vault.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/providers/vault/vault.go b/providers/vault/vault.go index 95f6f2f5..3b5efed9 100644 --- a/providers/vault/vault.go +++ b/providers/vault/vault.go @@ -9,7 +9,6 @@ import ( "time" "github.com/hashicorp/vault/api" - "github.com/knadh/koanf/maps" ) @@ -39,6 +38,10 @@ type Config struct { // Internal HTTP client timeout Timeout time.Duration + // Transport the optional HTTP client transport allows you to + // customize the settings like InsecureSkipVerify + Transport *http.Transport + // ExcludeMeta states whether the secret should be returned with its metadata. // If ExcludeMeta is true, no metadata will be returned, and the data can be // accessed as `k.String("key")`. If set to false, the value for data `key` @@ -54,7 +57,7 @@ type Vault struct { // Provider returns a provider that takes a Vault config. func Provider(cfg Config) *Vault { - httpClient := &http.Client{Timeout: cfg.Timeout} + httpClient := &http.Client{Timeout: cfg.Timeout, Transport: cfg.Transport} client, err := api.NewClient(&api.Config{Address: cfg.Address, HttpClient: httpClient}) if err != nil { return nil