Attempt re-auth on failure
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
dcd698c60d
commit
4f0fb2a170
16
main.go
16
main.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user