hashes passwords support

This commit is contained in:
Mikaël Cluseau
2023-12-17 17:29:08 +01:00
parent c02f701c04
commit b616b710cb
8 changed files with 130 additions and 99 deletions

View File

@ -291,6 +291,24 @@ func (s KVSecrets[T]) Put(key string, v T) (err error) {
return
}
func (s KVSecrets[T]) GetOrCreate(key string, create func() (T, error)) (v T, err error) {
v, found, err := s.Get(key)
if err != nil {
return
}
if !found {
v, err = create()
if err != nil {
return
}
err = s.Put(key, v)
}
return
}
func (s KVSecrets[T]) WsList(resp *restful.Response, prefix string) {
keys, err := s.Keys(prefix)
if err != nil {