Skip to main content

Function: getNodeEnv()

getNodeEnv(): string

Defined in: shared/utils/environment.ts:84

Get the current NODE_ENV value safely. Safe alternative to direct process.env.NODE_ENV access.

Returnsโ€‹

string

The NODE_ENV value or 'development' as fallback

Remarksโ€‹

Returns 'development' as fallback for safer development workflows and testing. This assumes development mode when environment is unspecified, which is appropriate for development tools and debugging features. Use getEnvironment() if you need to detect truly unspecified environments.

Exampleโ€‹

const env = getNodeEnv();
logger.debug("Current environment:", env);