feat: implement Strict environment validation across services and fro… - #224
Open
nikkybel wants to merge 1 commit into
Open
feat: implement Strict environment validation across services and fro…#224nikkybel wants to merge 1 commit into
nikkybel wants to merge 1 commit into
Conversation
|
Someone is attempting to deploy a commit to the karagoz's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
PR Description
Implementation Summary
1. Coordinator (
coordinator/src/config.ts)MAINNET_AUDIT_CONFIRMED=true)2. Resolver (
resolver/src/config.ts)3. Relayer (
relayer/src/index.ts)validateRelayerConfig()functionprocess.exit(1)on validation failure (fails fast)4. Frontend (
frontend/src/config/networks.ts)validateFrontendEnv()function that runs at build timeVITE_MAINNET_ENABLED=trueANDVITE_MAINNET_AUDIT_CONFIRMED=true5. Mainnet Safety Mechanism
All services now require explicit audit confirmation before allowing mainnet deployment:
MAINNET_AUDIT_CONFIRMED=trueVITE_MAINNET_ENABLED=true+VITE_MAINNET_AUDIT_CONFIRMED=trueThis prevents accidental mainnet enablement with clear error messages.
6. Smoke Tests (
coordinator/test/config-validation.test.ts)Created 8 test cases covering:
7. Documentation
env.example: Comprehensive list of all environment variables with descriptions and warningsdocs/DEPLOYMENT.md: Updated with environment validation section, troubleshooting guide, and environment variable referencedocs/ENVIRONMENT_VALIDATION.md: Complete implementation guide with error messages, deployment checklists, and migration guideAcceptance Criteria Met
✅ Each service fails at startup/build with clear error when required env vars are missing or malformed
✅ Mainnet enablement requires explicit audited/deployment confirmation variable (
MAINNET_AUDIT_CONFIRMED=true)✅ Tests cover invalid env cases (8 test cases in coordinator)
✅ Env documentation updated in canonical place (
env.example+docs/DEPLOYMENT.md+docs/ENVIRONMENT_VALIDATION.md)Key Features
close #33