fix: parse FRONTEND_URL env as a single string#77
Merged
Conversation
frontend_url was added to the system config env map and schema but the env parser had no case for it, so bootstrapSystemConfig threw Unhandled system config key: frontend_url whenever FRONTEND_URL was set. Handle it as a raw string (matching the z.url() schema), add a unit test, and document the variable in .env.example.
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.
Summary
The
frontend_urlsystem config (added for building magic-link redirects) was wired into the env map, schema, and consumer but never into the env parser.bootstrapSystemConfigcallsparseSystemConfigEnvValuefor every key inSYSTEM_CONFIG_ENV_MAP, so as soon asFRONTEND_URLwas set the parser hit itsdefaultbranch and threwUnhandled system config key: frontend_url, crashing the server on startup.Changes
parseSystemConfigEnvValuehandlesfrontend_urlas a raw string, matching thez.url().optional()schema and the${frontendUrl}/verify-magiclinkconsumer inmagicLinks.ts.frontend_urlparses to a single string, not an array.FRONTEND_URLin.env.example.Testing
npm run lint,npm run typecheck,npm run build: pass.FRONTEND_URLset, andPOST /auth/registration/registerreturns200 {"message":"Success"}through the portal API (previously500 fetch failedbecause the server never started).