Files
lazysecrets/internal/ui/app/usage.go
T
keb 10d1fc63c7 feat: config grouped by area, with per-provider timeouts and an update interval (#60)
Regroups the config, while there are no users to migrate:

- `ui`: icons, sourcesView, collapseGroups, loadDelay, expiryWarningDays
- `values`: revealTimeout, hideOnBlur, clipboardClear
- `storage`: cache, history
- `updates`: autoCheck (was updateCheck), autoCheckInterval (new, 24h by default), updateSources (was releases)
- `providers.timeout` (was timeout), plus `timeout` on azure, databricks and repos overriding it for that provider; `--timeout` still sets them all
- `sharing` (was share), in the config and in a repo's `.lazysecrets.yaml`

docs/config.md and the pages naming these keys are updated.

Reviewed-on: #60
Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
2026-10-13 20:23:55 +02:00

41 lines
1.2 KiB
Go

package app
import (
"git.kebcloud.no/keb/lazysecrets/internal/provider"
"git.kebcloud.no/keb/lazysecrets/internal/store"
)
// Usage: revealing, copying, opening in the browser, sharing and jumping
// to an item count as using it. The store keeps when each item was last
// used and how often, for the Recent section of the jump list. The config's
// storage.history: false turns this off.
// used counts a use of the remembered item key, keeping its context.
func (m *Model) used(key string) {
if !m.history {
return
}
_ = m.store.Use(key, m.now(), func(*store.Node) {}) // best effort: never in the way
}
// usedItem counts a use of an item, recording its context.
func (m *Model) usedItem(key, name string, path []string, src provider.Source) {
if !m.history {
return
}
_ = m.store.Use(key, m.now(), withContext(name, path, src))
}
func (m *Model) usedSource(s provider.Source) {
m.usedItem(sourceKey(s), s.Name, nil, s)
}
func (m *Model) usedContainer(c provider.Container) {
m.usedItem(storeKey(c), c.Name, []string{c.Source.Name}, c.Source)
}
func (m *Model) usedObject(o provider.Object) {
c := o.Container
m.usedItem(objectKey(o), o.Name, []string{c.Source.Name, c.Name}, c.Source)
}