- direnv (
brew install direnv
) - realpath (
brew install coreutils
) - copy .direnvrc to your home folder
- 1password cli
- create a file
.envrc
in your project root - copy the direnv/alias/xxx.envrc contents for the tools you need
cat direnv/alias/node.envrc >>> .envrc
cat direnv/alias/terraform.envrc >>> .envrc
For security reasons, every change to .envrc
requires you to approve those changes (you'll see it complain about it)
direnv allow
use it like you normally would
npm install
terraform plan
...
do this
# good example
.
├── module_1
│ ├── code
│ │ └── .envrc <<<<
│ └── infra
│ └── .envrc <<<<
└── module_2
├── code
│ └── .envrc <<<<
└── infra
└── .envrc <<<<
instead of this
# bad example
.
├── .envrc <<<<
├── module_1
│ ├── code-js
│ └── infra
└── module_2
├── code-java
└── infra
source shell/xxx.sh