Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions reference/environment-variables/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ loadEnv:

Files are loaded in the order specified.

## Config-Shaping Variables

<VersionBadge type="changed" version="v5.2.0" />

The three configuration env vars — `HARPER_DEFAULT_CONFIG`, `HARPER_CONFIG`, and `HARPER_SET_CONFIG` (see [Configuration](../configuration/overview.md)) — shape Harper's root configuration, which is composed once at startup, before components load. When one of these is delivered through a `loadEnv` `.env` file, Harper applies it before composing the configuration, so `.env` delivery behaves the same as setting a real process environment variable. (Prior to 5.2.0, these variables silently had no effect when delivered via `.env`, because they were read after the configuration had already been composed.)

Notes and limitations:

- A real process environment variable still takes precedence over the `.env` value, unless `loadEnv` is configured with `override: true`.
- Encrypted (`enc:v1:`) values cannot shape configuration — secret decryptors are not registered until components load. Such values are skipped with an error log.
- `componentsRoot` cannot be redirected this way: Harper discovers the `.env` files by scanning the components root from the config file, so a `componentsRoot` override delivered via env var or `.env` cannot change where that scan looks.
- Only these three variables are applied early. All other `.env` keys load at component-load time as usual.

## Related

- [Components Overview](../components/overview.md)
Expand Down