Repository navigation
Conversation
Fixes OpenSignLabs#1919 Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
|
@alfonsodg is attempting to deploy a commit to the prafull 's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
🟡 Changes recommended
Environment parsing, precedence, mode scoping, and Docker configuration delivery remain unresolved.
4 open issues
What changed in this PR
This PR attempts to make the frontend’s Vite build consume deployment settings from .env.prod, alongside the existing environment loading.
Changes:
- Reads
.env.prodfrom the build’s working directory when present. - Adds parsed values only when the existing environment lacks the key.
| File | Description |
|---|---|
apps/OpenSign/vite.config.js |
Adds supplemental .env.prod loading to the frontend configuration. |
Review effort: Balanced
| // Load ALL env vars (no prefix filter). Also load .env.prod (deploy artifact) if present. | ||
| const env = loadEnv(mode, process.cwd(), ""); | ||
| try { | ||
| const prodPath = path.resolve(process.cwd(), ".env.prod"); |
| const env = loadEnv(mode, process.cwd(), ""); | ||
| try { | ||
| const prodPath = path.resolve(process.cwd(), ".env.prod"); | ||
| if (fs.existsSync(prodPath)) { |
| if (idx < 0) continue; | ||
| const key = trimmed.slice(0, idx).trim(); | ||
| const value = trimmed.slice(idx + 1).trim(); | ||
| if (key && !(key in env)) env[key] = value; |
Comment on lines
+15
to
+24
| const content = fs.readFileSync(prodPath, "utf8"); | ||
| for (const line of content.split(/\r?\n/)) { | ||
| const trimmed = line.trim(); | ||
| if (!trimmed || trimmed.startsWith("#")) continue; | ||
| const idx = trimmed.indexOf("="); | ||
| if (idx < 0) continue; | ||
| const key = trimmed.slice(0, idx).trim(); | ||
| const value = trimmed.slice(idx + 1).trim(); | ||
| if (key && !(key in env)) env[key] = value; | ||
| } |
3 tasks
This branch has not been deployed
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.

Problem
The deployment ships
.env.prod, but Vite loads.env.productionduring aproduction build, so the values in
.env.prodwere not applied at build time.Only
REACT_APP_SERVERURLwas propagated at runtime, through the generatedenv.js.Affected files
apps/OpenSign/vite.config.jsFix
The Vite config now also reads
.env.prodwhen it is present, so the valuesthat the deployment actually ships are the ones that are compiled in.
Acceptance criteria
.env.prodare applied during the build.env/.env.localbehaviour is unchanged