Repository navigation
chore(env): validate environment variables before every build - #731
Merged
Merged
Conversation
Run validate:env --build as the prebuild step. It loads .env files the way next build does and fails the build, naming the variable, when no contract address is set or one is malformed; a missing runtime-only variable such as CRON_SECRET is reported as a warning. The validator now lists every variable in .env.example with its phase, and a test keeps the two in sync. The README documents each variable and where to obtain a value, and the CI builds pass the placeholder contract address.
|
@Vox-d-glitch is attempting to deploy a commit to the zintarh Team on Vercel. A member of the Team first needs to authorize it. |
|
@Vox-d-glitch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
Thanks for the contribution! This PR conflicted with recent changes on
Resolved and merged with PRmaster. Your commits are included in the merge. |
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.
I added a
prebuildscript that runspnpm validate:env --build, sopnpm buildnow fails beforenext buildstarts when a required variable is missing, with a message naming it. In--buildmode the validator loads.envfiles with@next/env, the same loader and precedencenext builduses, and checks the actual values rather than the documentation. Without the flag it keeps its existing documentation checks, which CI still runs.The validator now lists every variable in
.env.examplewith its phase. Build-timeNEXT_PUBLIC_*variables are inlined into the bundle, so a missing required one (at least one contract address, as.env.examplestates) or a malformed contract address fails the build. Runtime variables such asCRON_SECRETcan be provided by the deployment after the build, so a missing one produces a warning. A new test asserts that the validator and.env.exampledeclare the same variables and covers the build-time checks.The README now documents each variable's phase, whether it is required, what it does and where to get a value. The CI, Lighthouse and bundle-size builds pass the all-A placeholder contract address, which satisfies the check and which the app already treats as "no contract configured".
Closes #584