mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-03 13:58:22 -04:00
Read env config for predictions
This commit is contained in:
parent
2a4404c20a
commit
e3fff2a788
1 changed files with 15 additions and 1 deletions
|
|
@ -21,7 +21,21 @@ func NewPredict() *Predict {
|
|||
func (p *Predict) Client() *api.Client {
|
||||
p.clientOnce.Do(func() {
|
||||
if p.client == nil { // For tests
|
||||
p.client, _ = api.NewClient(nil)
|
||||
client, _ := api.NewClient(nil)
|
||||
|
||||
if client.Token() == "" {
|
||||
helper, err := DefaultTokenHelper()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
token, err := helper.Get()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
client.SetToken(token)
|
||||
}
|
||||
|
||||
p.client = client
|
||||
}
|
||||
})
|
||||
return p.client
|
||||
|
|
|
|||
Loading…
Reference in a new issue