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

feat: optional support net/http transport #232

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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