outpost: fix check for changed providers

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-11 13:50:04 +02:00
parent bf253643a6
commit 1e10f37370
1 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package ak
import (
"crypto/sha512"
"encoding/hex"
"encoding/json"
"goauthentik.io/outpost/pkg/client/outposts"
"goauthentik.io/outpost/pkg/models"
@ -16,8 +17,11 @@ func (a *APIController) Update() ([]*models.ProxyOutpostConfig, error) {
}
// Check provider hash to see if anything is changed
hasher := sha512.New()
bin, _ := providers.Payload.MarshalBinary()
hash := hex.EncodeToString(hasher.Sum(bin))
out, err := json.Marshal(providers.Payload.Results)
if err != nil {
return nil, nil
}
hash := hex.EncodeToString(hasher.Sum(out))
if hash == a.lastBundleHash {
return nil, nil
}