nvy 😡
nvy (pronounced "ehn-vee", like the word "envy") is a simple command line tool for managing multiple env files (profiles) in a project.
child processes cannot modify the environment of the parent process, so the use command outputs the command text which can be eval'd to set the environment variables.
usage ⚙️
cargo install nvynvy init- to create a new nvy.yaml filenvy use <profile>- to switch between profiles- (optional)
nvy export <target-file>- to configure exporting the environment variables to a file
shell mode:
eval "$(nvy use <profile>)"- to switch between profiles- You can add an alias to your shell config to make this easier:
alias nv='eval "$(nvy use $1)"'
why 🤔
have you ever had multiple configurations with different environment variables that you had to switch between? rather than tweaking the file by hand, or commenting out code, you can now:
- Define separate profiles (a .env* file for each)
- Use
nvyto easily switch between
also, this was an opportunity for me to learn Rust by doing.