All files / src/app/api/keycloak-config route.ts

0% Statements 0/2
0% Branches 0/5
0% Functions 0/1
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                       
import { NextResponse } from "next/server";
 
export const dynamic = "force-dynamic";
 
// Public config endpoint read by client components (UserMenu) that need to
// construct Keycloak-facing URLs at runtime instead of baking a
// NEXT_PUBLIC_* value into the browser bundle at build time. The URL is
// already visible to the browser once the user signs in, so exposing it
// unauthenticated is not a disclosure risk.
export async function GET() {
  return NextResponse.json({
    publicUrl:
      process.env.KEYCLOAK_PUBLIC_URL ?? "http://localhost:8080/realms/edcv",
    clientId:
      process.env.KEYCLOAK_CLIENT_ID ??
      process.env.KEYCLOAK_ID ??
      "health-dataspace-ui",
  });
}