Skip to content

deptno/inject-direnv

Repository files navigation

inject-direnv

find .envrc(until root directory) inject export variable if you are using JetBrain series, You can run IDE Run(option + F11) with injected .envrc

Install

npm install -D inject-direnv

Usage

WebStorm (Intellij)

Run Intellij(WebStorm)
Ctrl + A

In code

import 'inject-direnv'

Configuration

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

Basic concept

vim .envrc

save below text

export INJECT=true

Run node with -r inject-direnv option

node -r inject-direnv
> process.env.INJECT
'true'

License

MIT