Add config package: TOML loading with env overrides

- Base type with standard sections (Server, Database, MCIAS, Log)
- Duration wrapper type for TOML string→time.Duration decoding
- Generic Load[T] with TOML parse, reflection-based env overrides,
  defaults, required field validation, optional Validator interface
- Env overrides: PREFIX_SECTION_FIELD for string, duration, bool,
  []string (comma-separated)
- WebConfig exported for services with web UIs (not embedded in Base)
- 16 tests covering full/minimal configs, defaults, env overrides,
  validation, error cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 15:06:45 -07:00
parent 38da2e9a4b
commit 96d420ac82
6 changed files with 754 additions and 20 deletions

5
go.mod
View File

@@ -2,7 +2,10 @@ module git.wntrmute.dev/kyle/mcdsl
go 1.25.7
require modernc.org/sqlite v1.47.0
require (
github.com/pelletier/go-toml/v2 v2.3.0
modernc.org/sqlite v1.47.0
)
require (
github.com/dustin/go-humanize v1.0.1 // indirect