ss
This commit is contained in:
17
config/runtime-env.ts
Normal file
17
config/runtime-env.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export type RuntimeEnv = "development" | "production" | "test";
|
||||
|
||||
function normalizeRuntimeEnv(value?: string): RuntimeEnv {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
if (normalized === "production" || normalized === "prod") return "production";
|
||||
if (normalized === "test") return "test";
|
||||
return "development";
|
||||
}
|
||||
|
||||
export const RUNTIME_ENV = normalizeRuntimeEnv(
|
||||
process.env.APP_ENV ||
|
||||
process.env.NEXT_PUBLIC_APP_ENV ||
|
||||
process.env.NODE_ENV
|
||||
);
|
||||
|
||||
export const IS_DEVELOPMENT = RUNTIME_ENV === "development";
|
||||
export const IS_PRODUCTION = RUNTIME_ENV === "production";
|
||||
Reference in New Issue
Block a user