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.", }; // API_ORIGIN is an OPTIONAL override, read here on the server per request and // injected as window.__API_ORIGIN__ (see lib/api.ts). NEXT_PUBLIC_* would bake // it at build time (one URL per image); reading it here keeps one image usable // anywhere. Left unset — the normal case — this injects the empty string and // lib/api.ts derives the origin from window.location instead, so the app // follows the server when it moves without an env edit. 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 ?? ""; // 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. */}