Attempt re-auth on failure

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2022-11-16 12:58:34 +00:00
parent dcd698c60d
commit 4f0fb2a170
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

16
main.go
View File

@ -93,8 +93,20 @@ func processSecret(s *apiv1.Secret) {
item, err := opClient.GetSecret(vault, passwordID) item, err := opClient.GetSecret(vault, passwordID)
if err != nil { if err != nil {
log.Println("[ERROR] Could not get secret", err) if strings.Contains(err.Error(), "session expired") {
return 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) s.Data = make(map[string][]byte)