Skip to content

Commit

Permalink
feat: add custom net/http transport to Vault provider (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
missedone committed Sep 15, 2023
1 parent 8a4cf2a commit 4e88645
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions providers/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"time"

"github.com/hashicorp/vault/api"

"github.com/knadh/koanf/maps"
)

Expand Down Expand Up @@ -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`
Expand All @@ -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
Expand Down

0 comments on commit 4e88645

Please sign in to comment.