refactor: replace Viper with typed TOML configuration - #15
Draft
Portals wants to merge 1 commit into
Draft
Conversation
Portals
marked this pull request as draft
September 7, 2026 18:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces Viper with typed configuration loaded once at startup from defaults, the first config.toml, and nonempty environment variables. Preserves documented defaults, exact environment names, and file search order. Passes the maximum mail size directly to the router, removing global configuration from request handling and tests. Removes Viper and its unused transitive dependencies while retaining the existing TOML parser version.
Configuration now accepts TOML with documented field types only. Malformed or unreadable files and invalid port, size, or boolean values stop startup; missing files remain valid for environment-only configuration. These behavior changes are documented. Gmail authentication and the separately planned body-size/header hardening are unchanged.
Validation: uncached
go test -race -count=1 ./...,golangci-lint run(zero issues), command build, andgit diff --checkpassed. The production Docker image built successfully; disposable-container smoke tests passed for environment-only mock startup, authentication, mail response, configured size limits, and invalid-port startup failure. Containers were removed afterward.A fresh-context subagent independently reviewed commit
ede82bf116259f50dcb3c7f4c9aa14558f77bc3eagainst this PR's goal and returned OK.Stack: 6 of 6, based on #14 (
codex/05-standard-router). Review and merge in stack order: #10 → #11 → #12 → #13 → #14 → this PR.