import type { ReactNode } from "react"; import "./globals.css"; import { readBuildInfoFromEnv } from "@/lib/build-info"; export const metadata = { title: "Jorge Cuadros & Asociados — Plataforma", description: "Plataforma interna unificada de clientes, servicios y seguros.", }; // The browser talks to the API cross-origin, so it needs the API URL at // runtime. NEXT_PUBLIC_* would bake it at build time (one URL per image); we // want the URL to come from the deploy .env instead. So read it here on the // server per request and inject it as window.__API_ORIGIN__ (see lib/api.ts). // force-dynamic guarantees process.env is read at request time, never baked // into a static prerender. export const dynamic = "force-dynamic"; export default function RootLayout({ children }: { children: ReactNode }) { const apiOrigin = process.env.API_ORIGIN ?? process.env.NEXT_PUBLIC_API_ORIGIN ?? "http://localhost:3001"; // Same reason as the API origin: read on the server per request so the built // image is not pinned to one build identity in its client bundle. const build = readBuildInfoFromEnv(); return ( {/* Must run before the app bundle so lib/api.ts sees it at import. */}