Hi,
I have a rewrite configuration in next.config.ts in order to proxy some API requests:
const nextConfig = {
output: "standalone",
async rewrites() {
const base = process.env.EGD_API_BASE_URL;
if (!base) {
console.warn(
"EGD_API_BASE_URL is not set at build time; no /api rewrite will be emitted.",
);
return [];
}
return [
{
source: "/api/:path*",
destination: `${base}/:path*`,
},
];
},
};
export default nextConfig;
I think that what is happening is that it's not picking up the environment variable at runtime (this is built into a Docker container for production).
Am I thinking along the right lines? And if so, is there a way to have the environment variable picked up at runtime?