EnvParserOptions
Defined in: types.ts:33
Options for creating an env parser.
Properties
Section titled “Properties”appName
Section titled “appName”appName:
string
Defined in: types.ts:38
Display name for this app — used in debug output.
Should match your package.json name field.
loader?
Section titled “loader?”
optionalloader?:EnvLoader
Defined in: types.ts:43
Custom loader strategy. Defaults to DotenvLoader.
logger?
Section titled “logger?”
optionallogger?:EnvLogger
Defined in: types.ts:83
Structured logger for debug output (key-loaded counts, missing-key
warnings, deprecation notices). Defaults to console.info/console.warn.
namespaces?
Section titled “namespaces?”
optionalnamespaces?:string[]
Defined in: types.ts:77
Namespace prefixes to filter and strip from raw env var keys.
When set, only vars whose names start with one of these prefixes
(case-insensitive, followed by _) are visible to the parser.
The prefix is stripped before the key is normalised and looked up.
Uses a cascade model — later entries win when the same key
exists under multiple prefixes. Put broad/global namespaces first
and project-specific overrides last (same mental model as CSS
specificity or Object.assign).
This lets you share an org-wide namespace (e.g. HOLOCRON_ set
once in ~/.bashrc) as a base, then override individual vars with
a project-specific prefix in .env, without copying every global
var into each project.
Example
Section titled “Example”// HOLOCRON_DEBUG is the global default; CLI_TEMPLATE_DEBUG overrides it.createEnvParser({ appName: "my-cli", namespaces: ["HOLOCRON", "CLI_TEMPLATE"] })
// Single namespace — only HOLOCRON_* vars are visiblecreateEnvParser({ appName: "my-cli", namespaces: ["HOLOCRON"] })
// Completely custom — no org namespace at allcreateEnvParser({ appName: "my-cli", namespaces: ["MY_TOOL"] })parseValues?
Section titled “parseValues?”
optionalparseValues?:boolean
Defined in: types.ts:49
Whether to coerce “true”/“false”/numeric strings into their native types. Defaults to true.