mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 12:26:34 +02:00
Read env config for predictions
This commit is contained in:
parent
2a4404c20a
commit
e3fff2a788
@ -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…
x
Reference in New Issue
Block a user