feat: implement environment-based configuration package #53
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Roadmap Reference
Phase 1, Section 1.2 — Configuration
What to do
Create
internal/config/config.gothat reads all app configuration from environment variables:GITEA_URLGITEA_TOKENLISTEN_ADDR:8080SESSION_SECRETConfigstruct and aLoad() (*Config, error)functionString()method that masks the secret values for safe loggingAcceptance Criteria
config.Load()returns an error whenGITEA_URLorSESSION_SECRETare unsetgo test ./internal/config/...passes with table-driven tests covering missing-required-var and happy-path casesClosing as implemented.
internal/config/config.goon master contains:Configstruct with all four fields (GiteaURL, GiteaToken, ListenAddr, SessionSecret)Load() (*Config, error)that reads from env vars:8080for LISTEN_ADDRinternal/config/config_test.gocovering missing-required-var, short secret, default listen addr, and happy pathNote: The
String()method for safe logging mentioned in the issue is a minor gap but does not block functionality.