Move domain config from .env to a private SQLite store

Forges (multi-host) + tokens, project directories, and git identity now live in a private SQLite config store (internal/store, modernc.org/sqlite) on a /data named volume that is not bind-mounted or exposed, so credentials aren't reachable outside the container. New Settings page (/settings) + <settings-panel> with /api/config CRUD. Scanner reads roots fresh from the store each cycle; service resolves forges per-repo from the store and reapplies per-forge git auth on change. First run seeds the store from .env. Overturns the old no-datastore/.env-config laws (AGENT.md updated). Verified live end-to-end.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 05:31:28 -04:00
parent 69d38484e8
commit e30c3b632a
18 changed files with 1208 additions and 160 deletions
+21 -2
View File
@@ -14,8 +14,27 @@ import (
"gitmanager/internal/activity"
"gitmanager/internal/git"
"gitmanager/internal/repos"
"gitmanager/internal/store"
)
// testScanner builds a scanner whose roots are fixed to the given paths.
func testScanner(g *git.CLI, log *slog.Logger, roots ...string) *repos.Scanner {
return repos.NewScanner(g, log, func(context.Context) repos.Config {
return repos.Config{Roots: roots, MaxDepth: 3, Fetch: false}
}, time.Minute)
}
// testStore opens a throwaway SQLite store.
func testStore(t *testing.T) *store.Store {
t.Helper()
st, err := store.Open(filepath.Join(t.TempDir(), "config.db"))
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { st.Close() })
return st
}
// TestGitActions exercises the mutating commands (commit, discard) on a throwaway
// temp repo — never a real one.
func TestGitActions(t *testing.T) {
@@ -31,10 +50,10 @@ func TestGitActions(t *testing.T) {
log := slog.New(slog.NewTextHandler(io.Discard, nil))
g := git.New("git")
scanner := repos.NewScanner(g, log, []string{root}, 3, nil, time.Minute, false)
scanner := testScanner(g, log, root)
scanner.Refresh(context.Background())
feed := activity.New(log, 200)
svc := New(g, scanner.Index, feed, nil, scanner.RefreshRepo)
svc := New(g, scanner.Index, feed, testStore(t), log, scanner.RefreshRepo)
ctx := context.Background()
// Commit a new file, then the repo should be clean in the index.