File size: 777 Bytes
c09f67c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * 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();
}