mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
NEXT_PUBLIC_* is baked at build time so runtime docker-compose environment vars have no effect. Instead: - next.config.ts rewrites /api/* -> API_BASE_URL/api/* at the server level - api.ts uses relative paths (no env var in client bundle at all) - docker-compose passes API_BASE_URL=http://cvfs-backend:8080 at runtime - Dockerfile no longer needs any build args Requests: browser -> Next.js server (/api/*) -> cvfs-backend:8080 (/api/*) https://claude.ai/code/session_01Xmxm2QLgFBgRJyYD6VukR6
13 lines
372 B
TypeScript
13 lines
372 B
TypeScript
import type { NextConfig } from "next";
|
|
import path from "node:path";
|
|
|
|
const nextConfig: NextConfig = {
|
|
outputFileTracingRoot: path.join(process.cwd(), "../.."),
|
|
async rewrites() {
|
|
const backend = process.env.API_BASE_URL ?? "http://localhost:9812";
|
|
return [{ source: "/api/:path*", destination: `${backend}/api/:path*` }];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|