Merge pull request #231 from multica-ai/feat/remote-api-env-config

feat(web): support REMOTE_API_URL for remote backend proxy
This commit is contained in:
Bohan Jiang 2026-03-31 16:57:32 +08:00 committed by GitHub
commit 73b0fd98d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -44,3 +44,7 @@ FRONTEND_PORT=3000
FRONTEND_ORIGIN=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws
# Remote API (optional) — set to proxy local frontend to a remote backend
# Leave empty to use local backend (localhost:8080)
# REMOTE_API_URL=https://multica-api.copilothub.ai

View file

@ -1,6 +1,11 @@
import type { NextConfig } from "next";
import { config } from "dotenv";
import { resolve } from "path";
const remoteApiUrl = process.env.REMOTE_API_URL ?? "https://multica-api.copilothub.ai";
// Load root .env so REMOTE_API_URL is available to next.config.ts
config({ path: resolve(__dirname, "../../.env") });
const remoteApiUrl = process.env.REMOTE_API_URL || "http://localhost:8080";
const nextConfig: NextConfig = {
async rewrites() {