fix(settings): validate PORT instead of silently defaulting to 3000 - #5129
Merged
Conversation
A malformed PORT (non-numeric, zero, negative, non-integer) silently falls back to 3000 today via `Number(envVars.PORT) || 3000`, masking a misconfiguration instead of failing loudly. Reuses the toPositiveIntegerOrDefault helper #5123 introduced for DATABASE_POOL_MAX to apply the same validation here.
decocms Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
PR: #5129 fix(settings): validate PORT instead of silently defaulting to 3000 Bump type: patch - decocms (apps/mesh/package.json): 4.112.0 -> 4.112.1 Deploy-Scope: server
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.
Follows #5123, which hardened
DATABASE_POOL_MAXto reject malformed values via a newtoPositiveIntegerOrDefaulthelper instead of silently defaulting.portin the sameresolveConfigfunction still had the old pattern:Number(flags.port) || Number(envVars.PORT) || 3000.Payoff: a typo'd or malformed
PORT(e.g.PORT=abc,PORT=-1,PORT=0) currently falls back to 3000 with zero warning, so a deploy silently binds to the wrong port instead of failing fast at startup — exactly the class of bug #5123 just fixed for the pool-size setting.Fix: reuse the existing
toPositiveIntegerOrDefaulthelper forport, keeping the--portflag >PORTenv var precedence, defaulting to 3000 only when neither is set, and throwingPORT must be a positive integerotherwise.Reviewer check:
cd apps/mesh && bun test src/settings/resolve-config.test.tsVerified locally:
bun run fmt,bunx tsc --noEmit(apps/mesh workspace), and the targeted test file above (32 pass). Full CI runs the rest.Summary by cubic
Validate
PORTin mesh config and fail fast on invalid values instead of silently defaulting to 3000. Keeps--port>PORTprecedence and only defaults to 3000 when both are unset.toPositiveIntegerOrDefault("PORT", flags.port || envVars.PORT, 3000)inresolveConfig.Written for commit ce6fcc3. Summary will update on new commits.