Fix production vs development API base url handling#128
Open
Conversation
Deploying rp-web-info with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://83d09e4b.rp-web-info.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-info.pages.dev |
Deploying rp-web-hype with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://72e8d8ae.rp-web-hype.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-hype.pages.dev |
Deploying rp-web-site with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f582ea24.rp-web-site.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-site.pages.dev |
Deploying rp-web-admin with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://30363a30.rp-web-admin.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-admin.pages.dev |
Deploying rp-web-sponsor with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://71d563da.rp-web-sponsor.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-sponsor.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts how client apps resolve their runtime environment to ensure the correct API/WS base URLs are used in production vs development, including support for an unprefixed ENV variable.
Changes:
- Allow
sharedconfig to resolve environment from eitherENVorVITE_ENV. - Configure each Vite app to expose
ENVto the client viaenvPrefix. - Remove hardcoded API base URLs from app-local configs and bump the Docker base image Node version.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/src/config.ts | Resolve env from ENV or VITE_ENV when computing API/WS base URLs. |
| apps/template/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/site/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/admin/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/info/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/hype/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/sponsor/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/dashboard/vite.config.ts | Expose ENV via Vite envPrefix. |
| apps/sponsor/src/config.ts | Remove hardcoded API_BASE_URL from sponsor app config. |
| apps/admin/src/config.ts | Remove hardcoded API_BASE_URL (and old localhost comment) from admin app config. |
| Dockerfile | Update base image from Node 18 Alpine to Node 24 Alpine. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| port: 3005 | ||
| }, | ||
| plugins: [react()], | ||
| envPrefix: ["VITE_", "ENV"], |
| port: 3001 | ||
| }, | ||
| plugins: [react()], | ||
| envPrefix: ["VITE_", "ENV"], |
| port: 3004 | ||
| }, | ||
| plugins: [react()], | ||
| envPrefix: ["VITE_", "ENV"], |
| @@ -1,4 +1,4 @@ | |||
| FROM node:18-alpine | |||
| FROM node:24-alpine | |||
Comment on lines
+31
to
35
|
|
||
| const isProduction = resolvedEnv === "PRODUCTION"; | ||
|
|
||
| const IS_DEV = isDefined && !isProduction; | ||
|
|
| // https://vitejs.dev/config/ | ||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| envPrefix: ["VITE_", "ENV"], |
| port: 3003 | ||
| }, | ||
| plugins: [react()], | ||
| envPrefix: ["VITE_", "ENV"], |
| port: 3006 | ||
| }, | ||
| plugins: [react(), svgr()], | ||
| envPrefix: ["VITE_", "ENV"], |
Comment on lines
+11
to
12
| envPrefix: ["VITE_", "ENV"], | ||
| envDir: resolve(__dirname, "../.."), |
Deploying rp-web-dash with
|
| Latest commit: |
fc582ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d1a00009.rp-web-dash.pages.dev |
| Branch Preview URL: | https://fix-prod-vs-dev.rp-web-dash.pages.dev |
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.
No description provided.