Skip to content

Commit

Permalink
Issue #182: Initialize Vault client better
Browse files Browse the repository at this point in the history
Use the DefaultConfig and the environment variable
overrides of the Vault API when creating the client.
  • Loading branch information
magiconair committed Nov 4, 2016
1 parent 0a88383 commit 1b5df2c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cert/vault_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ type VaultSource struct {
}

func (s *VaultSource) client() (*api.Client, error) {
c, err := api.NewClient(&api.Config{Address: s.Addr})
conf := api.DefaultConfig()
if err := conf.ReadEnvironment(); err != nil {
return nil, err
}
if s.Addr != "" {
conf.Address = s.Addr
}
c, err := api.NewClient(conf)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1b5df2c

Please sign in to comment.