From 49b04fe9bb707cfcc2ba72bc4b5d8cdd797e86b5 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 10 Mar 2025 12:40:52 -0600 Subject: [PATCH] fix: use of old `AuthenticationToken` value Signed-off-by: Matthew Penner --- config/config.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 3bf57c6..2d0438a 100644 --- a/config/config.go +++ b/config/config.go @@ -369,11 +369,11 @@ func NewAtPath(path string) (*Configuration, error) { // will be paused until it is complete. func Set(c *Configuration) { mu.Lock() - if _config == nil || _config.AuthenticationToken != c.AuthenticationToken { - _jwtAlgo = jwt.NewHS256([]byte(c.AuthenticationToken)) + defer mu.Unlock() + if _config == nil || _config.Token.Token != c.Token.Token { + _jwtAlgo = jwt.NewHS256([]byte(c.Token.Token)) } _config = c - mu.Unlock() } // SetDebugViaFlag tracks if the application is running in debug mode because of @@ -381,9 +381,9 @@ func Set(c *Configuration) { // change to the disk. func SetDebugViaFlag(d bool) { mu.Lock() + defer mu.Unlock() _config.Debug = d _debugViaFlag = d - mu.Unlock() } // Get returns the global configuration instance. This is a thread-safe operation @@ -408,8 +408,8 @@ func Get() *Configuration { // the global configuration. func Update(callback func(c *Configuration)) { mu.Lock() + defer mu.Unlock() callback(_config) - mu.Unlock() } // GetJwtAlgorithm returns the in-memory JWT algorithm.