mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Don't write salts in initialization, look up on demand (#2702)
This commit is contained in:
@@ -21,7 +21,7 @@ type PathMap struct {
|
||||
Schema map[string]*FieldSchema
|
||||
CaseSensitive bool
|
||||
Salt *salt.Salt
|
||||
SaltMutex *sync.RWMutex
|
||||
SaltFunc func() (*salt.Salt, error)
|
||||
|
||||
once sync.Once
|
||||
}
|
||||
@@ -51,10 +51,12 @@ func (p *PathMap) pathStruct(k string) *PathStruct {
|
||||
}
|
||||
|
||||
// If we have a salt, apply it before lookup
|
||||
if p.Salt != nil {
|
||||
p.SaltMutex.RLock()
|
||||
k = p.Salt.SaltID(k)
|
||||
p.SaltMutex.RUnlock()
|
||||
salt := p.Salt
|
||||
if p.SaltFunc != nil {
|
||||
salt, _ = p.SaltFunc()
|
||||
}
|
||||
if salt != nil {
|
||||
k = salt.SaltID(k)
|
||||
}
|
||||
|
||||
return &PathStruct{
|
||||
|
||||
Reference in New Issue
Block a user