platform-tooling/run/utils/env.ts
2026-03-03 21:04:03 -08:00

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';