Skip to main content
@wolfstar/env-utilities loads layered dotenv files and provides strict parsers for application configuration.

Load Dotenv Files

Use the side-effect entry point when the default .env path is enough:
For an explicit path or custom options, call setup:
The loader applies environment-specific files with the most specific value first:
.env.local is intentionally skipped in the test environment.

Type Application Keys

Augment the package’s Env interface so parsers accept your keys:

Parse Values

Missing required keys throw ReferenceError. Invalid values throw TypeError. A provided default is returned as-is.

Configure the Loader Itself

You can set DOTENV_PATH, DOTENV_ENV, DOTENV_PREFIX, DOTENV_ENCODING, and DOTENV_DEBUG before setup. Keep secrets outside source control and configure them through your deployment platform.