Move Config out of package main into internal/config #157

Closed
opened 2026-10-07 11:40:18 +00:00 by aniram · 0 comments
Owner

Config and its init() env loading currently live in main.go, so only the main package can use them. Both binaries will need AppRoot, Env and DBFilename.
Create internal/config exposing a loaded Config (prefer a Load() (Config, error) function over init() with a global, so a missing CHMBR_ROOT produces a clear error instead of a silent zero value).

Keep the env var names and defaults unchanged.
The web-only fields (Host, Port) can stay in the same struct for now.

Acceptance criteria:

  • main.go no longer defines Config.
  • Missing required env vars return an error that the caller can print and exit on. (TODO)
Config and its init() env loading currently live in main.go, so only the main package can use them. Both binaries will need AppRoot, Env and DBFilename. Create internal/config exposing a loaded Config (prefer a Load() (Config, error) function over init() with a global, so a missing CHMBR_ROOT produces a clear error instead of a silent zero value). Keep the env var names and defaults unchanged. The web-only fields (Host, Port) can stay in the same struct for now. Acceptance criteria: - main.go no longer defines Config. - Missing required env vars return an error that the caller can print and exit on. (TODO)
aniram added this to the 2027.1 milestone 2026-10-07 11:41:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
overdrives/chambersbr#157
No description provided.