refactor: changed removing secret from store returns error

This commit is contained in:
David Allen 2025-03-20 09:28:24 -06:00 committed by David Allen
parent c3e1b40e3b
commit 0333caa403
Signed by: towk
GPG key ID: 0430CDBE22619155
3 changed files with 11 additions and 4 deletions

View file

@ -102,10 +102,16 @@ func (l *LocalSecretStore) ListSecrets() (map[string]string, error) {
}
// RemoveSecretByID removes the specified secretID stored locally
func (l *LocalSecretStore) RemoveSecretByID(secretID string) {
func (l *LocalSecretStore) RemoveSecretByID(secretID string) error {
l.mu.RLock()
// Let user know if there was nothing to delete
_, err := l.GetSecretByID(secretID)
if err != nil {
return err
}
delete(l.Secrets, secretID)
l.mu.RUnlock()
return nil
}
// openStore tries to create or open the LocalSecretStore based on the environment