mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
/**
|
|
* Environment utility functions for consistent environment detection across the application
|
|
*/
|
|
import { env, getEnv, isTruthy } from './env'
|
|
|
|
/**
|
|
* Is the application running in production mode
|
|
*/
|
|
export const isProd = env.NODE_ENV === 'production'
|
|
|
|
/**
|
|
* Is the application running in development mode
|
|
*/
|
|
export const isDev = env.NODE_ENV === 'development'
|
|
|
|
/**
|
|
* Is the application running in test mode
|
|
*/
|
|
export const isTest = env.NODE_ENV === 'test'
|
|
|
|
/**
|
|
* Is this the hosted version of the application
|
|
*/
|
|
export const isHosted =
|
|
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
|
|
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
|
|
|
|
/**
|
|
* Is billing enforcement enabled
|
|
*/
|
|
export const isBillingEnabled = isTruthy(env.BILLING_ENABLED)
|
|
|
|
/**
|
|
* Is email verification enabled
|
|
*/
|
|
export const isEmailVerificationEnabled = isTruthy(env.EMAIL_VERIFICATION_ENABLED)
|
|
|
|
/**
|
|
* Get cost multiplier based on environment
|
|
*/
|
|
export function getCostMultiplier(): number {
|
|
return isProd ? (env.COST_MULTIPLIER ?? 1) : 1
|
|
}
|