refactor(web): update environment variable handling to use build-time constants for auth type, deployment mode, and ETL service

This commit is contained in:
Anish Sarkar 2026-06-16 15:55:57 +05:30
parent 3f69bfd5e4
commit 695da76f2e
3 changed files with 15 additions and 11 deletions

View file

@ -1,14 +1,18 @@
import { connection } from "next/server";
import { RuntimeConfigProvider } from "@/components/providers/runtime-config";
import { AUTH_TYPE, DEPLOYMENT_MODE, ETL_SERVICE } from "@/lib/env-config";
import {
BUILD_TIME_AUTH_TYPE,
BUILD_TIME_DEPLOYMENT_MODE,
BUILD_TIME_ETL_SERVICE,
} from "@/lib/env-config";
export async function RuntimeConfig({ children }: { children: React.ReactNode }) {
await connection();
const value = {
authType: process.env.AUTH_TYPE ?? AUTH_TYPE,
etlService: process.env.ETL_SERVICE ?? ETL_SERVICE,
deploymentMode: process.env.DEPLOYMENT_MODE ?? DEPLOYMENT_MODE,
authType: process.env.AUTH_TYPE ?? BUILD_TIME_AUTH_TYPE,
etlService: process.env.ETL_SERVICE ?? BUILD_TIME_ETL_SERVICE,
deploymentMode: process.env.DEPLOYMENT_MODE ?? BUILD_TIME_DEPLOYMENT_MODE,
};
return <RuntimeConfigProvider value={value}>{children}</RuntimeConfigProvider>;