refactor(core): remove store global singleton, thread store explicitly

Remove store.Get()/SetGlobal()/Current. Store is now passed explicitly
to all consumers via constructor parameters and function arguments.

- TUI Model holds store field, set via InitialModel(isAdmin, store)
- monitor.StartEngine(s) and InitHistoryFromStore(s) accept store
- server.Start(cfg, s) closes over store in HTTP handlers
- main.go threads store to SSH server, TUI, monitor, server
- isKeyAllowed receives store as parameter

No more hidden dependency on package-level mutable state in store pkg.
Monitor package still uses package-level state (LiveState, etc.) — will
be encapsulated into Engine struct in Phase 7.
This commit is contained in:
2026-05-15 00:45:07 -04:00
parent d4f4012c8a
commit a6bb9a7aff
9 changed files with 62 additions and 94 deletions
-10
View File
@@ -35,13 +35,3 @@ type Store interface {
ExportData() (models.Backup, error)
ImportData(data models.Backup) error
}
var Current Store
func SetGlobal(s Store) {
Current = s
}
func Get() Store {
return Current
}