Add local and NetBox server notes and improve reliability
Release / release (push) Successful in 6m52s

This commit is contained in:
Sebastian Unterschütz committed 2026-10-27 17:51:59 +01:00
1 parent 2852dff2c4
commit 12cc64fdd9
17 files changed
+848 -83

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@ package cache
import (
"encoding/json"
"git.zb-server.de/Sebi/ssh-netbox-wrapper/internal/storage"
"os"
"path/filepath"
"sort"
@@ -116,12 +117,15 @@ func (c *Cache) Save() error {
if err != nil {
return err
}
return os.WriteFile(c.path, data, 0o644)
return storage.WriteFile(c.path, data, 0o600)
}
func (c *Cache) Upsert(e Entry) {
e.CachedAt = time.Now()
c.mu.Lock()
if old, ok := c.entries[e.Name]; ok && e.LastUsed.IsZero() {
e.LastUsed = old.LastUsed
}
c.entries[e.Name] = e
c.mu.Unlock()
}