- Add /api/config endpoint for runtime env var fetching - Add config.ts service with sync getters (getApiUrl, getBackofficeUrl, etc.) - Add ConfigContext for React components - Update api.ts, auth.ts, storage.ts to use runtime config - Update layout.tsx to wrap app with ConfigProvider - Fix Dockerfile default port from 8080 to 8521 This allows the frontend to read environment variables at runtime instead of baking them in during build time.
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import type React from "react"
|
|
import type { Metadata } from "next"
|
|
import { GeistSans } from "geist/font/sans"
|
|
import { GeistMono } from "geist/font/mono"
|
|
import { Analytics } from "@vercel/analytics/next"
|
|
import { Toaster } from "sonner"
|
|
import { NotificationProvider } from "@/contexts/notification-context"
|
|
import { ThemeProvider } from "@/contexts/ThemeContext"
|
|
import { ConfigProvider } from "@/contexts/ConfigContext"
|
|
import { I18nProvider } from "@/lib/i18n"
|
|
import "./globals.css"
|
|
import { Suspense } from "react"
|
|
import { LoadingScreen } from "@/components/ui/loading-spinner"
|
|
|
|
export const metadata: Metadata = {
|
|
title: "GoHorseJobs - Find your next opportunity",
|
|
description: "Connecting candidates and companies quickly and directly",
|
|
generator: "v0.app",
|
|
icons: {
|
|
icon: "/logohorse.png",
|
|
shortcut: "/logohorse.png",
|
|
apple: "/logohorse.png",
|
|
},
|
|
}
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode
|
|
}>) {
|
|
const shouldLoadAnalytics =
|
|
process.env.VERCEL === "1" || Boolean(process.env.NEXT_PUBLIC_VERCEL_ANALYTICS_ID)
|
|
|
|
return (
|
|
<html lang="en">
|
|
<body className={`font-sans ${GeistSans.variable} ${GeistMono.variable} antialiased`}>
|
|
<ConfigProvider>
|
|
<I18nProvider>
|
|
<ThemeProvider>
|
|
<NotificationProvider>
|
|
<Suspense fallback={<LoadingScreen text="GoHorse Jobs" />}>{children}</Suspense>
|
|
<Toaster
|
|
position="top-right"
|
|
richColors
|
|
closeButton
|
|
expand={false}
|
|
duration={4000}
|
|
/>
|
|
</NotificationProvider>
|
|
</ThemeProvider>
|
|
</I18nProvider>
|
|
</ConfigProvider>
|
|
{process.env.NODE_ENV === "production" && shouldLoadAnalytics && <Analytics />}
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|