From e51a16f6220c122a20d120abff40d91b20fbf661 Mon Sep 17 00:00:00 2001 From: GoHorse Deploy Date: Sat, 7 Feb 2026 19:48:28 +0000 Subject: [PATCH] trigger rebuild --- frontend/src/app/api/config/route.ts | 64 +++++++------------------ frontend/src/contexts/ConfigContext.tsx | 2 +- frontend/src/lib/config.ts | 2 +- 3 files changed, 20 insertions(+), 48 deletions(-) diff --git a/frontend/src/app/api/config/route.ts b/frontend/src/app/api/config/route.ts index 6691888..c60142f 100644 --- a/frontend/src/app/api/config/route.ts +++ b/frontend/src/app/api/config/route.ts @@ -1,46 +1,18 @@ -import { NextResponse } from 'next/server'; - -export const runtime = 'edge'; - -/** - * Runtime Configuration API - * - * This endpoint returns environment variables that are read at RUNTIME, - * not build time. This allows changing configuration without rebuilding. - * - * IMPORTANT: Use env vars WITHOUT the NEXT_PUBLIC_ prefix here! - * - NEXT_PUBLIC_* = baked in at build time (bad for runtime config) - * - Regular env vars = read at runtime (good!) - * - * In your .env or container config, set: - * API_URL=https://api.example.com - * BACKOFFICE_URL=https://backoffice.example.com - * (etc.) - * - * The NEXT_PUBLIC_* versions are only used as fallbacks for local dev. - */ -export async function GET() { - // Priority: Runtime env vars > Build-time NEXT_PUBLIC_* > Defaults - const config = { - apiUrl: process.env.API_URL - || process.env.NEXT_PUBLIC_API_URL - || 'https://api.rede5.com.br/', - backofficeUrl: process.env.BACKOFFICE_URL - || process.env.NEXT_PUBLIC_BACKOFFICE_URL - || 'http://localhost:3001', - seederApiUrl: process.env.SEEDER_API_URL - || process.env.NEXT_PUBLIC_SEEDER_API_URL - || 'http://localhost:3002', - scraperApiUrl: process.env.SCRAPER_API_URL - || process.env.NEXT_PUBLIC_SCRAPER_API_URL - || 'http://localhost:3003', - }; - - return NextResponse.json(config, { - headers: { - // Cache for 5 minutes to avoid too many requests - 'Cache-Control': 'public, max-age=300, s-maxage=300', - }, - }); -} - +import { NextResponse } from 'next/server'; + +export const runtime = 'nodejs'; + +export async function GET() { + const config = { + apiUrl: process.env.API_URL || 'https://api.rede5.com.br/', + backofficeUrl: process.env.BACKOFFICE_URL || 'https://b-local.gohorsejobs.com', + seederApiUrl: process.env.SEEDER_API_URL || 'http://localhost:3002', + scraperApiUrl: process.env.SCRAPER_API_URL || 'http://localhost:3003', + }; + + return NextResponse.json(config, { + headers: { + 'Cache-Control': 'public, max-age=300, s-maxage=300', + }, + }); +} diff --git a/frontend/src/contexts/ConfigContext.tsx b/frontend/src/contexts/ConfigContext.tsx index bd17724..aa55066 100644 --- a/frontend/src/contexts/ConfigContext.tsx +++ b/frontend/src/contexts/ConfigContext.tsx @@ -11,7 +11,7 @@ export interface RuntimeConfig { const defaultConfig: RuntimeConfig = { apiUrl: process.env.NEXT_PUBLIC_API_URL || 'https://api.rede5.com.br/', - backofficeUrl: process.env.NEXT_PUBLIC_BACKOFFICE_URL || 'http://localhost:3001', + backofficeUrl: process.env.NEXT_PUBLIC_BACKOFFICE_URL || 'https://b-local.gohorsejobs.com', seederApiUrl: process.env.NEXT_PUBLIC_SEEDER_API_URL || 'http://localhost:3002', scraperApiUrl: process.env.NEXT_PUBLIC_SCRAPER_API_URL || 'http://localhost:3003', }; diff --git a/frontend/src/lib/config.ts b/frontend/src/lib/config.ts index aa7a45b..f55205d 100644 --- a/frontend/src/lib/config.ts +++ b/frontend/src/lib/config.ts @@ -25,7 +25,7 @@ export interface RuntimeConfig { // Default values (fallback to build-time env or hardcoded defaults) const defaultConfig: RuntimeConfig = { apiUrl: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8521', - backofficeUrl: process.env.NEXT_PUBLIC_BACKOFFICE_URL || 'http://localhost:3001', + backofficeUrl: process.env.NEXT_PUBLIC_BACKOFFICE_URL || 'https://b-local.gohorsejobs.com', seederApiUrl: process.env.NEXT_PUBLIC_SEEDER_API_URL || 'http://localhost:3002', scraperApiUrl: process.env.NEXT_PUBLIC_SCRAPER_API_URL || 'http://localhost:3003', };