Commit d61cee7
committed
fix(env-preload): later layer can override earlier (was: first wins)
The old guard `if (process.env[key] !== undefined) continue` skipped any
key that already existed in process.env at the time of the check. After
~/.jitsu/.env.local loaded, every shared key was in process.env, so the
repo-level <repo>/.env.local could never override it — backwards from
the documented "later wins" precedence.
Snapshot the shell's original env keys at startup; only those are
untouchable. Keys set by a previous file load are overwritable, so the
order is now:
shell > <repo>/.env.local > ~/.jitsu/.env.local
Verified end-to-end: repo overrides home for shared keys; home-only
keys still load; shell still wins over both.1 parent 6d2512b commit d61cee7
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
0 commit comments