feat: RSL starten in Dev mode 15 Sek. und in prod. 120 Sek.

This commit is contained in:
ISA
2025-08-12 08:25:22 +02:00
parent 100dab06ed
commit e4b56faf75
7 changed files with 39 additions and 13 deletions

17
utils/env.ts Normal file
View File

@@ -0,0 +1,17 @@
// Centralized, typed access to public environment variables
// NEXT_PUBLIC_* variables are exposed to the browser by Next.js at build time.
export const NODE_ENV = process.env.NODE_ENV;
const toNumber = (val: string | undefined): number | undefined => {
if (val === undefined) return undefined;
const n = Number(val);
return Number.isFinite(n) ? n : undefined;
};
// RSL measurement duration in seconds. Default: 15s in dev, 120s otherwise.
export const RSL_DURATION_SECONDS: number = (() => {
const fromEnv = toNumber(process.env.NEXT_PUBLIC_RSL_DURATION_SECONDS);
if (fromEnv !== undefined) return fromEnv;
return NODE_ENV === "development" ? 15 : 120;
})();