mirror of
https://github.com/quexten/goldwarden.git
synced 2025-01-23 08:39:52 +01:00
Fix sync errors
This commit is contained in:
parent
99f36bfe5e
commit
61d490d5a0
@ -137,6 +137,11 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
|||||||
// attempt to sync every minute until successful
|
// attempt to sync every minute until successful
|
||||||
for {
|
for {
|
||||||
bitwarden.RefreshToken(ctx, &cfg)
|
bitwarden.RefreshToken(ctx, &cfg)
|
||||||
|
token, err := cfg.GetToken()
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Could not get token: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
userSymmetricKey, err := cfg.GetUserSymmetricKey()
|
userSymmetricKey, err := cfg.GetUserSymmetricKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
@ -152,7 +157,8 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
|||||||
|
|
||||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, &protectedUserSymetricKey, true)
|
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, &protectedUserSymetricKey, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
log.Error("Could not sync: %s", err.Error())
|
||||||
|
notify.Notify("Goldwarden", "Could not perform initial sync", "", 0, func() {})
|
||||||
time.Sleep(60 * time.Second)
|
time.Sleep(60 * time.Second)
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
@ -214,6 +220,12 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
|||||||
if !gotToken {
|
if !gotToken {
|
||||||
log.Warn("Could not get token")
|
log.Warn("Could not get token")
|
||||||
return false
|
return false
|
||||||
|
} else {
|
||||||
|
token, err = cfg.GetToken()
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Could not get token: %s", err.Error())
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
userSymmetricKey, err := cfg.GetUserSymmetricKey()
|
userSymmetricKey, err := cfg.GetUserSymmetricKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -229,6 +241,7 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
|||||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, &protectedUserSymetricKey, true)
|
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, &protectedUserSymetricKey, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Could not sync: %s", err.Error())
|
log.Error("Could not sync: %s", err.Error())
|
||||||
|
notify.Notify("Goldwarden", "Could not perform initial sync on ssh unlock", "", 0, func() {})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Warn("Access token is empty")
|
log.Warn("Access token is empty")
|
||||||
@ -265,7 +278,7 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token), vault, &cfg, nil, false)
|
bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, nil, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -154,7 +154,7 @@ func StartVirtualAgent(runtimeConfig config.RuntimeConfig) (chan []byte, chan []
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token), vault, &cfg, nil, false)
|
bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, nil, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user