environment
constenvironment:object
Defined in: environment.ts:68
Resolves and classifies the current environment.
Type Declaration
Section titled “Type Declaration”get: (
logger) =>"local"|"development"|"ci"|"test"|"preview"|"production"|"agent"=getEnvironment
Resolves the environment from HOLOCRON_ENVIRONMENT, ENVIRONMENT, ENV or NODE_ENV (first set wins), warning and falling back to the default when the value is not recognised.
Resolve the current environment from input or process.env.
Parameters
Section titled “Parameters”logger?
Section titled “logger?”Pick<EnvLogger, "warn"> = consoleWarn
Returns
Section titled “Returns”"local" | "development" | "ci" | "test" | "preview" | "production" | "agent"
isDeployed
Section titled “isDeployed”isDeployed: (
logger?) =>boolean
Whether the current environment is a deployed one (test, preview or production).
Parameters
Section titled “Parameters”logger?
Section titled “logger?”Pick<EnvLogger, "warn">
Returns
Section titled “Returns”boolean
normalize
Section titled “normalize”normalize: (
value) =>"local"|"development"|"ci"|"test"|"preview"|"production"|"agent"|undefined=normalizeEnvironment
Maps a string or alias (prod, prd, staging, qa, dev, …) to its canonical Environment, or undefined when it is not recognised.
Normalize a string into a canonical Environment. Returns undefined if the value is not recognized.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”"local" | "development" | "ci" | "test" | "preview" | "production" | "agent" | undefined