Skip to content

fix(config): trim host values from env and flag parsing#16

Merged
masterkain merged 1 commit intomainfrom
feat/locate-and-fix-critical-bug
Mar 2, 2026
Merged

fix(config): trim host values from env and flag parsing#16
masterkain merged 1 commit intomainfrom
feat/locate-and-fix-critical-bug

Conversation

@masterkain
Copy link
Member

Motivation

  • Host values provided via environment or CLI flags could retain leading/trailing whitespace which leads to exact-string mismatches when binding or matching origins.
  • Normalizing host input prevents subtle runtime errors when comparing RuntimeConfig.Host against request origins or bind addresses.
  • Add regression coverage to ensure host trimming behavior remains stable.

Description

  • Trim WOOTTY_HOST by introducing normalizeHost and use it when constructing RuntimeConfig instead of accepting raw env values.
  • Trim the --host flag argument during CLI parsing before assigning to the runtime configuration.
  • Add tests TestParseRunConfigTrimsHostFromEnvironment and TestParseRunConfigTrimsHostFromFlag to apps/server/internal/config/config_test.go to cover both env and flag cases.
  • Files changed: apps/server/internal/config/config.go and apps/server/internal/config/config_test.go.

Testing

  • Ran the repository JS unit suite with pnpm test (Vitest) and the web tests completed successfully (note: environment Node version warning was observed).
  • Ran Go unit tests for the server with cd apps/server && go test ./internal/config ./internal/server and they passed.
  • New config tests specifically for host trimming executed and succeeded as part of the Go test run.

Codex Task

@masterkain masterkain merged commit 1304922 into main Mar 2, 2026
3 checks passed
@masterkain masterkain deleted the feat/locate-and-fix-critical-bug branch March 2, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant