From 4785c8567957426b6aa5d65c1c851f5883530904 Mon Sep 17 00:00:00 2001 From: Nick Tan Date: Wed, 13 Sep 2023 08:56:41 -0700 Subject: [PATCH] feat: support customize net/http transport --- 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