find .envrc
(until root directory) inject export variable
if you are using JetBrain series, You can run IDE Run(option
+ F11
) with injected .envrc
npm install -D inject-direnv
Run Intellij(WebStorm)
Ctrl
+ A
import 'inject-direnv'
Default target direnv file is .envrc
,
you can change with INJECT_DIRENV_ENVRC
variable
Edit .envrc.local
export ENVRC_LOCAL=yes
Export INJECT_DIRENV_ENVRC
export INJECT_DIRENV_ENVRC=.envrc.local
Load package
import 'inject-direnv'
console.log(process.env.ENVRC_LOCAL)
// yes
vim .envrc
save below text
export INJECT=true
Run node
with -r inject-direnv
option
node -r inject-direnv
> process.env.INJECT
'true'
MIT