outposts: always update bundles and swap maps
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -1,10 +1,6 @@ | ||||
| package ak | ||||
|  | ||||
| import ( | ||||
| 	"crypto/sha512" | ||||
| 	"encoding/hex" | ||||
| 	"encoding/json" | ||||
|  | ||||
| 	"goauthentik.io/outpost/pkg/client/outposts" | ||||
| 	"goauthentik.io/outpost/pkg/models" | ||||
| ) | ||||
| @ -15,16 +11,5 @@ func (a *APIController) Update() ([]*models.ProxyOutpostConfig, error) { | ||||
| 		a.logger.WithError(err).Error("Failed to fetch providers") | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	// Check provider hash to see if anything is changed | ||||
| 	hasher := sha512.New() | ||||
| 	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 | ||||
| 	} | ||||
| 	a.lastBundleHash = hash | ||||
| 	return providers.Payload.Results, nil | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer