Skip to content

Commit 42c6f52

Browse files
add env loading to component docs
1 parent 6634866 commit 42c6f52

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/developers/components/reference.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ harper-nextjs-test-feature:
6969
# ...
7070
```
7171

72+
#### Environment Variable Loading
73+
74+
All Harper components support environment variable loading using the `loadEnv` option.
75+
76+
This option can be set to `true` to automatically load a `.env` file from the component root, or set to a string of the path to an environment variable file.
77+
78+
For example, to automatically load `/.env`:
79+
80+
```yaml
81+
loadEnv: true
82+
```
83+
84+
Or to specify an exact environment variable file:
85+
86+
```yaml
87+
loadEnv: '.env.production'
88+
```
89+
90+
> Important: Harper is a single process application. Environment variables are loaded onto `process.env` and will be shared throughout all Harper components. This means environment variables loaded by one component will be available on other components (as long as the components are loaded in the correct order).
91+
7292
### Default Component Configuration
7393

7494
Harper components do not need to specify a `config.yaml`. Harper uses the following default configuration to load components.

0 commit comments

Comments
 (0)