Skip to content

Commit 1b24b60

Browse files
built-in component
1 parent 42c6f52 commit 1b24b60

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

docs/developers/components/built-in.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Harper provides extended features using built-in components. They do **not** nee
77
- [graphql](#graphql)
88
- [graphqlSchema](#graphqlschema)
99
- [jsResource](#jsresource)
10+
- [loadEnv](#loadenv)
1011
- [rest](#rest)
1112
- [roles](#roles)
1213
- [static](#static)
@@ -66,6 +67,19 @@ jsResource:
6667
files: './resource.js'
6768
```
6869

70+
## loadEnv
71+
72+
Load environment variables via files like `.env`.
73+
74+
This component is a [Resource Extension](./reference.md#resource-extension) and can be configured with the [`files`, `path`, and `root`](./reference.md#resource-extension-configuration) configuration options.
75+
76+
```yaml
77+
loadEnv:
78+
files: './.env'
79+
```
80+
81+
> 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).
82+
6983
<!-- ## login -->
7084

7185
<!-- ## mqtt -->

docs/developers/components/reference.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,6 @@ 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-
9272
### Default Component Configuration
9373

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

0 commit comments

Comments
 (0)