#env-var #env #env-file #dotenv #environment #config-file

bin+lib envset

A command-line tool for setting environment variables in a .env file

15 releases

0.1.17 Oct 9, 2024
0.1.13 Sep 24, 2024

#120 in Configuration

Download history 586/week @ 2024-09-05 241/week @ 2024-09-12 322/week @ 2024-09-19 65/week @ 2024-09-26 149/week @ 2024-10-03 60/week @ 2024-10-10 5/week @ 2024-10-17

311 downloads per month

ISC license

47KB
1K SLoC

envset

envset is a CLI for setting environment variables in .env files.

this is something you may have never considered needing a specialized tool for. and you don't. but just like updating a git config it's more fun with a command.

installation

currently available on homebrew and crates.io

brew install schpet/tap/envset
cargo install envset

usage

set vars

# basic usage, FYI that it prints a diff of the changes to stdout
envset KEY1=value1 KEY2=value2

# some env vars are normally very annoying to set, like json or multiline strings.
# but envset has your back!
envset JSON="$(cat credentials.json)" PRIVATE_KEY="$(openssl genrsa -out /dev/stdout 2048)"

# pipe in stdin, useful for copying stuff from one env to another
echo -e "KEY1=value1\nKEY2=value2" | envset

# heroku users can easily copy parts of their config
heroku config -s | grep "^AWS_" | envset

# override the default path to a .env file
envset -f .env.test KEY1=value1

read vars

# a few ways to print the current .env
envset
envset print --json

# grab a single value
envset get KEY1

# keys only, thanks
envset keys

delete vars

envset delete KEY1 KEY2

about

this cli was thrown together quickly with aider, i also put up a blog post explaining why i made this.

Dependencies

~4–15MB
~134K SLoC