15 lines
435 B
TypeScript
15 lines
435 B
TypeScript
![]() |
import { DEFAULT } from "@/constants/default";
|
||
|
|
||
|
import type { Environment } from "@/types/environment";
|
||
|
|
||
|
export const defineEnvironment = (): Environment => {
|
||
|
const environments: Environment[] = ["development", "staging", "production"];
|
||
|
const environment = process.env.ENVIRONMENT as Environment | undefined;
|
||
|
|
||
|
if (environment && environments.includes(environment)) {
|
||
|
return environment;
|
||
|
}
|
||
|
|
||
|
return DEFAULT.environment;
|
||
|
};
|