fix(cli): fix deco services CLI's stale duplicate of externalUrlOrNull - #5220
Merged
Merged
Conversation
The `deco services up/down` externalUrlOrNull had its own copy of the external-host check, missing the bracketed-IPv6 fix landed in #5217 for resolve-config.ts's copy. A bracketed IPv6 loopback DATABASE_URL/NATS_URL (e.g. "postgres://[::1]:5432/postgres") kept the brackets in `URL#hostname`, failed the bare "::1" comparison, and was wrongly treated as external — skipping local Postgres/NATS provisioning. Export the already-fixed, already-tested resolve-config.ts helper and import it in services.ts instead of keeping a second copy.
decocms Bot
pushed a commit
that referenced
this pull request
Jul 24, 2026
PR: #5220 fix(cli): fix deco services CLI's stale duplicate of externalUrlOrNull Bump type: patch - decocms (apps/api/package.json): 4.125.2 -> 4.125.3 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.
Follow-up hardening on #5217 (fix(settings): treat bracketed IPv6 loopback DATABASE_URL/NATS_URL as local).
That PR fixed
externalUrlOrNullinapps/api/src/settings/resolve-config.tsto strip brackets fromURL#hostnamebefore comparing against the bare loopback forms (localhost,127.0.0.1,::1). It missed thatapps/api/src/cli/commands/services.tskept its own private copy of the exact same function, used bydeco services up/down.Failure scenario: running
deco services upwithDATABASE_URL="postgres://[::1]:5432/postgres"orNATS_URL="nats://[::1]:4222"—URL#hostnamereturns"[::1]"(brackets kept), which doesn't match the bare"::1"check, so the CLI's copy misclassifies a local loopback address as an external service.ensureServicesthen skips provisioning the local managed Postgres/NATS (skipPostgres/skipNatsgate directly on this null-check, seeapps/api/src/services/ensure-services.ts:1507-1508), leaving nothing listening at that address.Fix: export the already-fixed, already-tested
externalUrlOrNullfromresolve-config.tsand import it inservices.tsinstead of keeping a second, drifted copy — net -12 lines, no behavior change to the already-correct path, only closes the gap in the duplicate.Verify:
bun test apps/api/src/settings/resolve-config.test.ts(58 pass, including the bracketed-IPv6 cases added by #5217, which now also exercise the code pathservices.tsdelegates to) andcd apps/api && bunx tsc --noEmit(clean). No new test added — the fix removes the duplicate rather than adding parallel logic, so the existing resolve-config.test.ts coverage is now the only coverage needed for both call sites.Ran locally:
bun run fmt, targetedbunx tsc --noEmitin apps/api, and the single test file above. Full CI validates the rest.Summary by cubic
Fixes the
deco servicesCLI misclassifying bracketed IPv6 loopback URLs as external. Reuses the exportedexternalUrlOrNullfromresolve-config.tsand removes the stale duplicate, so local Postgres/NATS are provisioned as expected.Written for commit 6925643. Summary will update on new commits.