38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
/**
|
|
* Environment detection and helpers
|
|
*
|
|
* Pure environment detection with no dependencies on config.
|
|
* For getEnvFile(), import from config.ts instead.
|
|
*/
|
|
|
|
// =============================================================================
|
|
// Types
|
|
// =============================================================================
|
|
|
|
export type Environment = 'dev' | 'prod' | 'staging';
|
|
|
|
// =============================================================================
|
|
// Environment Detection
|
|
// =============================================================================
|
|
|
|
/**
|
|
* Get the current environment from LILITH_ENV or default to 'dev'
|
|
*/
|
|
export function getEnvironment(): Environment {
|
|
const env = process.env.LILITH_ENV;
|
|
if (env === 'prod') return 'prod';
|
|
if (env === 'staging') return 'staging';
|
|
return 'dev';
|
|
}
|
|
|
|
/** Current environment */
|
|
export const environment = getEnvironment();
|
|
|
|
/** True if running in development mode */
|
|
export const isDev = environment === 'dev';
|
|
|
|
/** True if running in production mode */
|
|
export const isProd = environment === 'prod';
|
|
|
|
/** True if running in staging mode */
|
|
export const isStaging = environment === 'staging';
|