refactor: config consolidation + Server type extraction #108
Reference in New Issue
Block a user
Delete Branch "refactor/config-server"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Phase 5b of the review-findings backlog — two independent architectural cleanups.
Commit 1 — config consolidation:
cmd/uptop/config.gowithappConfigstruct +parseConfig()UPTOP_*env vars parsed in one place with defaultsrunServe()simplified:cfg := parseConfig()up front, no scatteredos.GetenvcallsserverConfig()method buildsserver.ServerConfigfrom the consolidated structCommit 2 — Server type extraction:
Start()god function →Serverstruct with 11 named handler methodsroutes()registers all endpoints,middleware()chain applied oncerequireAuth()helper replaces repeated auth checksStart()kept as convenience wrapper so existing callers work unchangedTest plan
go test -race ./...— all passgolangci-lint— 0 issuesos.Getenv("UPTOP_")in runServe body (only in parseConfig + other subcommands)