Env Update
This commit is contained in:
1 parent
f2b9993427
commit
9282777ac9
9 files changed
+60
-21
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
// Server-only env var (no NEXT_PUBLIC_ prefix), so it is NOT inlined into the
|
||||
// client bundle at build time. force-dynamic makes Next.js read process.env
|
||||
// fresh on every request instead of caching this route's output, so a single
|
||||
// built image can be promoted across environments and reconfigured purely via
|
||||
// the container's runtime env (e.g. a Kubernetes ConfigMap) without rebuilding.
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export interface RuntimeConfig {
|
||||
apiUrl: string;
|
||||
}
|
||||
|
||||
export function GET(): NextResponse<RuntimeConfig> {
|
||||
const apiUrl = process.env.API_URL ?? 'http://localhost:3001/api/v1';
|
||||
return NextResponse.json({ apiUrl });
|
||||
}
|
||||
Reference in new issue
Block a user