Midday / apps /worker /src /utils /env.ts
Jules
Final deployment with all fixes and verified content
c09f67c
/**
* Environment utility functions
* Centralized logic for checking environment variables
*/
/**
* Check if the worker is running in production environment
* Checks WORKER_ENV
*/
export function isProduction(): boolean {
return process.env.WORKER_ENV === "production";
}
/**
* Check if the worker is running in staging environment
* Checks WORKER_ENV or RAILWAY_ENVIRONMENT for staging indicators
*/
export function isStaging(): boolean {
return (
process.env.WORKER_ENV === "staging" ||
process.env.RAILWAY_ENVIRONMENT === "staging"
);
}
/**
* Check if the worker is running in a non-production environment
* Useful for skipping scheduled tasks or enabling debug features
*/
export function isDevelopment(): boolean {
return !isProduction();
}