Skip to content

basalt / core/src / isProductionEnvironment

Function: isProductionEnvironment() ​

> isProductionEnvironment(nodeEnv?): boolean

Defined in: core/src/environment.ts:14

The single, fail-closed answer to "is this production?" shared by every Basalt package that changes a security default on NODE_ENV.

Only an EXPLICIT NODE_ENV=development or NODE_ENV=test counts as a non-production environment. Unset, empty, staging, a typo of production, … are all treated as production, so a deploy that forgets NODE_ENV gets the strict defaults (strong secrets, Secure cookies, redacted logs) instead of the development ones.

Vitest sets NODE_ENV=test when it is unset, so test suites keep the development defaults without extra configuration.

Parameters ​

nodeEnv? ​

string | undefined

Returns ​

boolean

Released under the MIT License.