mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
Move API base URL to server-side configuration via Next.js rewrites
This commit is contained in:
@@ -3,6 +3,10 @@ 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;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const API = process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:9812";
|
||||
// Empty base: all API calls go to /api/* which Next.js rewrites to the backend.
|
||||
// The actual backend URL is set via API_BASE_URL env var in next.config.ts (server-side, runtime).
|
||||
const API = "";
|
||||
|
||||
export type StructuredBlock = {
|
||||
path: string;
|
||||
@@ -130,4 +132,3 @@ export async function publishVersion(
|
||||
});
|
||||
}
|
||||
|
||||
export { API as API_BASE_URL };
|
||||
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
context: ./
|
||||
dockerfile: ./docker/webapp.Dockerfile
|
||||
environment:
|
||||
- NEXT_PUBLIC_API_BASE_URL=https://api.cv.alves.world
|
||||
- API_BASE_URL=http://cvfs-backend:8080
|
||||
networks:
|
||||
- dokploy-network
|
||||
- cvfs-network
|
||||
|
||||
Reference in New Issue
Block a user