Config: .env = projects root only; derive each project's forge from git

Reduce .env to just REPOS_HOST_PATH (the projects root); runtime bootstrap moves to compose/defaults. Projects are the subdirectories of the single root — removed the project-directories feature (store table, service methods, /api/config/project-dirs, Settings section). Each project's forge is derived from its git remote (matched to a configured forge, else the bare host) and shown as a pill next to its name (State.Forge via scanner ForgeFor + svc.ForgeDisplay). Removed first-run .env seeding; forges + identity are managed in Settings. Added forge.HostOf. AGENT.md updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 05:52:03 -04:00
parent e30c3b632a
commit 32ae17cc9f
15 changed files with 175 additions and 434 deletions
+11 -20
View File
@@ -23,28 +23,25 @@ type Config struct {
TLSCertFile string // PEM cert (e.g. an mkcert leaf trusted by the OS store)
TLSKeyFile string // PEM private key
// DBPath is the SQLite config store (forges, project dirs, git identity).
// It lives on a private volume, not accessible outside the container (§1.3).
// DBPath is the SQLite config store (forges + tokens, git identity). It lives
// on a private volume, not accessible outside the container (§1.3).
DBPath string
RepoRoots []string // SEED ONLY: roots to scan, used to seed the store on first run
GitBin string // path to the git binary
// ProjectsRoot is the single directory (inside the container) under which each
// project lives in its own subdirectory. This is the one thing set in .env
// (as REPOS_HOST_PATH on the host, mounted here); everything else is either a
// compose/env default or lives in the config store.
ProjectsRoot string
GitBin string // path to the git binary
ScanInterval time.Duration // scanner refresh interval
ScanMaxDepth int // max discovery depth under each root
ScanMaxDepth int // max discovery depth under the root
ScanIgnore []string // directory names to skip during discovery
ScanFetchEnabled bool // allow the scanner to run `git fetch`
Dev bool // readable console logging vs structured JSON
LogFile string // optional file to also append logs to
GitUserName string // commit identity for git actions run by the app
GitUserEmail string // commit identity for git actions run by the app
GiteaURL string // Gitea/Forgejo base URL (e.g. https://git.nilles.net)
GiteaToken string // Gitea token (read + PR write + branch delete) — §8.4
GitHubToken string // optional forge token (later provider)
GitLabToken string // optional forge token (later provider)
}
// Load reads .env (if present) then the environment, applying defaults.
@@ -55,22 +52,16 @@ func Load() (Config, error) {
c := Config{
ListenAddr: env("LISTEN_ADDR", "127.0.0.1:8080"),
DBPath: env("GITMANAGER_DB", "/data/gitmanager.db"),
ProjectsRoot: env("PROJECTS_ROOT", "/repos"),
HTTPSAddr: env("HTTPS_ADDR", ""),
TLSCertFile: env("TLS_CERT_FILE", ""),
TLSKeyFile: env("TLS_KEY_FILE", ""),
RepoRoots: splitList(env("GIT_REPO_ROOTS", "")),
GitBin: env("GIT_BIN", "git"),
ScanMaxDepth: envInt("SCAN_MAX_DEPTH", 4),
ScanIgnore: splitList(env("SCAN_IGNORE", "node_modules,vendor,.cache")),
ScanFetchEnabled: envBool("SCAN_FETCH_ENABLED", false),
Dev: strings.EqualFold(env("APP_ENV", "dev"), "dev"),
LogFile: env("LOG_FILE", ""),
GitUserName: env("GIT_USER_NAME", ""),
GitUserEmail: env("GIT_USER_EMAIL", ""),
GiteaURL: env("GITEA_URL", ""),
GiteaToken: env("GITEA_TOKEN", ""),
GitHubToken: env("GITHUB_TOKEN", ""),
GitLabToken: env("GITLAB_TOKEN", ""),
}
interval, err := time.ParseDuration(env("SCAN_INTERVAL", "30s"))