Skip to content

Fix production vs development API base url handling#128

Open
J164 wants to merge 3 commits intomainfrom
fix-prod-vs-dev
Open

Fix production vs development API base url handling#128
J164 wants to merge 3 commits intomainfrom
fix-prod-vs-dev

Conversation

@J164
Copy link
Member

@J164 J164 commented Mar 17, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 17, 2026 20:02
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying rp-web-info with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying rp-web-hype with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying rp-web-site with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying rp-web-admin with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying rp-web-sponsor with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 shared config to resolve environment from either ENV or VITE_ENV.
  • Configure each Vite app to expose ENV to the client via envPrefix.
  • 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, "../.."),
@cloudflare-workers-and-pages
Copy link

Deploying rp-web-dash with  Cloudflare Pages  Cloudflare Pages

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

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants