@harperfast/template-vue-ts-studio 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1833,20 +1833,18 @@ Instructions for the agent to follow when loading environment variables from `.e
|
|
|
1833
1833
|
|
|
1834
1834
|
#### When to Use
|
|
1835
1835
|
|
|
1836
|
-
Apply this rule when a Harper application needs to load secrets or configuration values from `.env` files into `process.env` at startup. Use it whenever
|
|
1836
|
+
Apply this rule when a Harper application needs to load secrets or configuration values from `.env` files into `process.env` at startup. Use it whenever hardcoding values must be avoided and environment-specific configuration must be supplied to Harper components.
|
|
1837
1837
|
|
|
1838
1838
|
#### How It Works
|
|
1839
1839
|
|
|
1840
|
-
1. **Declare `loadEnv` in `config.yaml`**: Add `loadEnv`
|
|
1840
|
+
1. **Declare `loadEnv` in `config.yaml`**: Add `loadEnv` as a top-level key. It is built into Harper and requires no installation.
|
|
1841
1841
|
|
|
1842
1842
|
```yaml
|
|
1843
1843
|
loadEnv:
|
|
1844
1844
|
files: '.env'
|
|
1845
1845
|
```
|
|
1846
1846
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
2. **Place `loadEnv` first**: Always declare `loadEnv` before any other components in `config.yaml` so environment variables are available before dependent components start. Because Harper is single-process, variables loaded onto `process.env` are shared across all components.
|
|
1847
|
+
2. **Place `loadEnv` first**: Always list `loadEnv` before any other components in `config.yaml` so that environment variables are available on `process.env` before dependent components start.
|
|
1850
1848
|
|
|
1851
1849
|
```yaml
|
|
1852
1850
|
# config.yaml — loadEnv must come first
|
|
@@ -1859,7 +1857,9 @@ Apply this rule when a Harper application needs to load secrets or configuration
|
|
|
1859
1857
|
files: './src/*.js'
|
|
1860
1858
|
```
|
|
1861
1859
|
|
|
1862
|
-
3. **
|
|
1860
|
+
3. **Configure the `files` option**: Provide one or more paths or glob patterns pointing to the env files to load. This option is required.
|
|
1861
|
+
|
|
1862
|
+
4. **Set `override` if needed**: By default, existing environment variables take precedence over values in `.env` files. Set `override: true` to reverse this and have loaded values win.
|
|
1863
1863
|
|
|
1864
1864
|
```yaml
|
|
1865
1865
|
loadEnv:
|
|
@@ -1867,22 +1867,36 @@ Apply this rule when a Harper application needs to load secrets or configuration
|
|
|
1867
1867
|
override: true
|
|
1868
1868
|
```
|
|
1869
1869
|
|
|
1870
|
-
|
|
1870
|
+
5. **Load multiple files when required**: Supply a list of files or a glob pattern. Files are loaded in the order specified.
|
|
1871
1871
|
```yaml
|
|
1872
1872
|
loadEnv:
|
|
1873
1873
|
files:
|
|
1874
1874
|
- '.env'
|
|
1875
1875
|
- '.env.local'
|
|
1876
1876
|
```
|
|
1877
|
-
|
|
1877
|
+
or
|
|
1878
1878
|
```yaml
|
|
1879
1879
|
loadEnv:
|
|
1880
1880
|
files: 'env-vars/*'
|
|
1881
1881
|
```
|
|
1882
1882
|
|
|
1883
|
+
##### Configuration Options
|
|
1884
|
+
|
|
1885
|
+
| Option | Type | Required | Description |
|
|
1886
|
+
| ---------- | -------------------- | -------- | -------------------------------------------------------------------------------------- |
|
|
1887
|
+
| `files` | `string \| string[]` | **Yes** | Path(s) or glob pattern(s) to the env file(s) to load. |
|
|
1888
|
+
| `override` | `boolean` | No | If `true`, loaded values override existing environment variables. Defaults to `false`. |
|
|
1889
|
+
|
|
1883
1890
|
#### Examples
|
|
1884
1891
|
|
|
1885
|
-
|
|
1892
|
+
**Minimal setup — single `.env` file:**
|
|
1893
|
+
|
|
1894
|
+
```yaml
|
|
1895
|
+
loadEnv:
|
|
1896
|
+
files: '.env'
|
|
1897
|
+
```
|
|
1898
|
+
|
|
1899
|
+
**Full `config.yaml` with load order, multiple files, and override:**
|
|
1886
1900
|
|
|
1887
1901
|
```yaml
|
|
1888
1902
|
# config.yaml — loadEnv must come first
|
|
@@ -1898,19 +1912,16 @@ myApp:
|
|
|
1898
1912
|
files: './src/*.js'
|
|
1899
1913
|
```
|
|
1900
1914
|
|
|
1901
|
-
|
|
1915
|
+
**Glob pattern:**
|
|
1902
1916
|
|
|
1903
1917
|
```yaml
|
|
1904
1918
|
loadEnv:
|
|
1905
|
-
files: '
|
|
1906
|
-
|
|
1907
|
-
myApp:
|
|
1908
|
-
files: './src/*.js'
|
|
1919
|
+
files: 'env-vars/*'
|
|
1909
1920
|
```
|
|
1910
1921
|
|
|
1911
1922
|
#### Notes
|
|
1912
1923
|
|
|
1913
|
-
- `loadEnv` is built into Harper —
|
|
1914
|
-
-
|
|
1915
|
-
- Without `override: true`, variables already
|
|
1916
|
-
- `
|
|
1924
|
+
- `loadEnv` is built into Harper — do not install it separately; only declare it in `config.yaml`.
|
|
1925
|
+
- Because Harper is a single-process application, variables loaded onto `process.env` are shared across all components.
|
|
1926
|
+
- Without `override: true`, variables already set in the shell or container environment will not be overwritten by values in `.env` files.
|
|
1927
|
+
- `files` is the only required option; omitting it will produce an invalid configuration.
|
|
@@ -7,8 +7,8 @@ metadata:
|
|
|
7
7
|
mode: generate
|
|
8
8
|
sources:
|
|
9
9
|
- reference/v5/environment-variables/overview.md
|
|
10
|
-
sourceCommit:
|
|
11
|
-
inputHash:
|
|
10
|
+
sourceCommit: 42231db17c025a4a455e3d91875fad4084a01cb5
|
|
11
|
+
inputHash: fe610fc245226357
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Load Environment Variables with loadEnv
|
|
@@ -17,20 +17,18 @@ Instructions for the agent to follow when loading environment variables from `.e
|
|
|
17
17
|
|
|
18
18
|
## When to Use
|
|
19
19
|
|
|
20
|
-
Apply this rule when a Harper application needs to load secrets or configuration values from `.env` files into `process.env` at startup. Use it whenever
|
|
20
|
+
Apply this rule when a Harper application needs to load secrets or configuration values from `.env` files into `process.env` at startup. Use it whenever hardcoding values must be avoided and environment-specific configuration must be supplied to Harper components.
|
|
21
21
|
|
|
22
22
|
## How It Works
|
|
23
23
|
|
|
24
|
-
1. **Declare `loadEnv` in `config.yaml`**: Add `loadEnv`
|
|
24
|
+
1. **Declare `loadEnv` in `config.yaml`**: Add `loadEnv` as a top-level key. It is built into Harper and requires no installation.
|
|
25
25
|
|
|
26
26
|
```yaml
|
|
27
27
|
loadEnv:
|
|
28
28
|
files: '.env'
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
2. **Place `loadEnv` first**: Always declare `loadEnv` before any other components in `config.yaml` so environment variables are available before dependent components start. Because Harper is single-process, variables loaded onto `process.env` are shared across all components.
|
|
31
|
+
2. **Place `loadEnv` first**: Always list `loadEnv` before any other components in `config.yaml` so that environment variables are available on `process.env` before dependent components start.
|
|
34
32
|
|
|
35
33
|
```yaml
|
|
36
34
|
# config.yaml — loadEnv must come first
|
|
@@ -43,7 +41,9 @@ Apply this rule when a Harper application needs to load secrets or configuration
|
|
|
43
41
|
files: './src/*.js'
|
|
44
42
|
```
|
|
45
43
|
|
|
46
|
-
3. **
|
|
44
|
+
3. **Configure the `files` option**: Provide one or more paths or glob patterns pointing to the env files to load. This option is required.
|
|
45
|
+
|
|
46
|
+
4. **Set `override` if needed**: By default, existing environment variables take precedence over values in `.env` files. Set `override: true` to reverse this and have loaded values win.
|
|
47
47
|
|
|
48
48
|
```yaml
|
|
49
49
|
loadEnv:
|
|
@@ -51,22 +51,36 @@ Apply this rule when a Harper application needs to load secrets or configuration
|
|
|
51
51
|
override: true
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
5. **Load multiple files when required**: Supply a list of files or a glob pattern. Files are loaded in the order specified.
|
|
55
55
|
```yaml
|
|
56
56
|
loadEnv:
|
|
57
57
|
files:
|
|
58
58
|
- '.env'
|
|
59
59
|
- '.env.local'
|
|
60
60
|
```
|
|
61
|
-
|
|
61
|
+
or
|
|
62
62
|
```yaml
|
|
63
63
|
loadEnv:
|
|
64
64
|
files: 'env-vars/*'
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
### Configuration Options
|
|
68
|
+
|
|
69
|
+
| Option | Type | Required | Description |
|
|
70
|
+
| ---------- | -------------------- | -------- | -------------------------------------------------------------------------------------- |
|
|
71
|
+
| `files` | `string \| string[]` | **Yes** | Path(s) or glob pattern(s) to the env file(s) to load. |
|
|
72
|
+
| `override` | `boolean` | No | If `true`, loaded values override existing environment variables. Defaults to `false`. |
|
|
73
|
+
|
|
67
74
|
## Examples
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
**Minimal setup — single `.env` file:**
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
loadEnv:
|
|
80
|
+
files: '.env'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Full `config.yaml` with load order, multiple files, and override:**
|
|
70
84
|
|
|
71
85
|
```yaml
|
|
72
86
|
# config.yaml — loadEnv must come first
|
|
@@ -82,19 +96,16 @@ myApp:
|
|
|
82
96
|
files: './src/*.js'
|
|
83
97
|
```
|
|
84
98
|
|
|
85
|
-
|
|
99
|
+
**Glob pattern:**
|
|
86
100
|
|
|
87
101
|
```yaml
|
|
88
102
|
loadEnv:
|
|
89
|
-
files: '
|
|
90
|
-
|
|
91
|
-
myApp:
|
|
92
|
-
files: './src/*.js'
|
|
103
|
+
files: 'env-vars/*'
|
|
93
104
|
```
|
|
94
105
|
|
|
95
106
|
## Notes
|
|
96
107
|
|
|
97
|
-
- `loadEnv` is built into Harper —
|
|
98
|
-
-
|
|
99
|
-
- Without `override: true`, variables already
|
|
100
|
-
- `
|
|
108
|
+
- `loadEnv` is built into Harper — do not install it separately; only declare it in `config.yaml`.
|
|
109
|
+
- Because Harper is a single-process application, variables loaded onto `process.env` are shared across all components.
|
|
110
|
+
- Without `override: true`, variables already set in the shell or container environment will not be overwritten by values in `.env` files.
|
|
111
|
+
- `files` is the only required option; omitting it will produce an invalid configuration.
|
package/package.json
CHANGED
package/skills-lock.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"source": "harperfast/skills",
|
|
6
6
|
"sourceType": "github",
|
|
7
7
|
"skillPath": "harper-best-practices/SKILL.md",
|
|
8
|
-
"computedHash": "
|
|
8
|
+
"computedHash": "921b0848ec9f7ee375fec2d4191c99325e1d7160c0ab463832b3e0443e80576a"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
}
|