Skip to content

Commit

Permalink
Initialize the keyring cache
Browse files Browse the repository at this point in the history
- Initialize the keyring cache to prevent errors when using keyring
  template functions.
  • Loading branch information
halostatue committed Mar 13, 2021
1 parent 926da7c commit a665328
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/keyringtemplatefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func (c *Config) keyringTemplateFunc(service, user string) string {
returnTemplateError(fmt.Errorf("%s %s: %w", service, user, err))
return ""
}

if c.keyring.cache == nil {
c.keyring.cache = make(map[keyringKey]string)
}

c.keyring.cache[key] = password
return password
}

0 comments on commit a665328

Please sign in to comment.