Skip to content

Commit

Permalink
core: hold rlock when reading config; add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
calvn committed Oct 7, 2019
1 parent 219d6ee commit d5b5a9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -1988,13 +1988,18 @@ func (c *Core) SetLogLevel(level log.Level) {
}
}

// SetConfig sets core's config object to the newly provided config.
func (c *Core) SetConfig(conf *server.Config) {
c.stateLock.Lock()
c.rawConfig = conf
c.stateLock.Unlock()
}

// SanitizedConfig returns a sanitized version of the current config.
// See server.Config.Sanitized for specific values omitted.
func (c *Core) SanitizedConfig() map[string]interface{} {
c.stateLock.RLock()
defer c.stateLock.RUnlock()
return c.rawConfig.Sanitized()
}

Expand Down

0 comments on commit d5b5a9f

Please sign in to comment.