mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
refactor: export function to save JSON secrets
This commit is contained in:
parent
6ae0121af7
commit
5c624de821
1 changed files with 2 additions and 2 deletions
|
|
@ -84,7 +84,7 @@ func (l *LocalSecretStore) StoreSecretByID(secretID, secret string) error {
|
||||||
|
|
||||||
l.mu.Lock()
|
l.mu.Lock()
|
||||||
l.Secrets[secretID] = encryptedSecret
|
l.Secrets[secretID] = encryptedSecret
|
||||||
err = saveSecrets(l.filename, l.Secrets)
|
err = SaveSecrets(l.filename, l.Secrets)
|
||||||
l.mu.Unlock()
|
l.mu.Unlock()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +134,7 @@ func OpenStore(filename string) (SecretStore, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saves secrets back to the JSON file
|
// Saves secrets back to the JSON file
|
||||||
func saveSecrets(jsonFile string, store map[string]string) error {
|
func SaveSecrets(jsonFile string, store map[string]string) error {
|
||||||
file, err := os.OpenFile(jsonFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
file, err := os.OpenFile(jsonFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue