From 5b3941a4259d9d987c2313c0ecc162fde2a27618 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 23 Apr 2021 10:08:19 +0200 Subject: [PATCH] outposts: always update bundles and swap maps Signed-off-by: Jens Langhammer --- outpost/pkg/ak/api.go | 9 +-------- outpost/pkg/ak/api_update.go | 15 --------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/outpost/pkg/ak/api.go b/outpost/pkg/ak/api.go index d8d0a8d14..c4ead9265 100644 --- a/outpost/pkg/ak/api.go +++ b/outpost/pkg/ak/api.go @@ -31,8 +31,7 @@ type APIController struct { Server Outpost - lastBundleHash string - logger *log.Entry + logger *log.Entry reloadOffset time.Duration @@ -71,18 +70,12 @@ func NewAPIController(akURL url.URL, token string) *APIController { logger: log, reloadOffset: time.Duration(rand.Intn(10)) * time.Second, - - lastBundleHash: "", } ac.logger.Debugf("HA Reload offset: %s", ac.reloadOffset) ac.initWS(akURL, outpost.Pk) return ac } -func (a *APIController) GetLastBundleHash() string { - return a.lastBundleHash -} - // Start Starts all handlers, non-blocking func (a *APIController) Start() error { err := a.Server.Refresh() diff --git a/outpost/pkg/ak/api_update.go b/outpost/pkg/ak/api_update.go index d3211ef1b..48dbbd1db 100644 --- a/outpost/pkg/ak/api_update.go +++ b/outpost/pkg/ak/api_update.go @@ -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 }