Skip to content

Commit

Permalink
fix: use of old AuthenticationToken value
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Penner <[email protected]>
  • Loading branch information
matthewpi committed Mar 10, 2025
1 parent 9535aae commit 49b04fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,21 @@ 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
// a command line flag argument. If so we do not want to store that 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
Expand All @@ -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.
Expand Down

0 comments on commit 49b04fe

Please sign in to comment.