Attempt re-auth on failure
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
dcd698c60d
commit
4f0fb2a170
12
main.go
12
main.go
@ -92,10 +92,22 @@ func processSecret(s *apiv1.Secret) {
|
||||
vault := keys["vault"]
|
||||
|
||||
item, err := opClient.GetSecret(vault, passwordID)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "session expired") {
|
||||
opClient, err = buildOpClient()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
item, err = opClient.GetSecret(vault, passwordID)
|
||||
if err != nil {
|
||||
log.Println("[ERROR] Could not get secret", err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Println("[ERROR] Could not get secret", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
s.Data = make(map[string][]byte)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user