Using a comment pattern in your .env files, easily swap between envs in local development.
Install via. homebrew
- Connect to the cenv tap
brew tap jonshort/cenv
- Install
cenv
from the tap
brew install cenv
-
Download the latest binary from the releases page
-
Decide if you want to execute the binary directly, or using an environment variable
- Add the "cenv" pattern to your .env file
VARIABLE_1=something
# ++ local ++
# API_ADDRESS=http://localhost:5000
# REQUIRE_LOGIN=false
# ++ live ++
# API_ADDRESS=https://myliveapi.com
# REQUIRE_LOGIN=true
- Run cenv, choosing an env keyword to use
cenv live
- Check your .env, the keyworded env vars will now be uncommented
VARIABLE_1=something
# ++ local ++
# API_ADDRESS=http://localhost:5000
# REQUIRE_LOGIN=false
# ++ live ++
API_ADDRESS=https://myliveapi.com
REQUIRE_LOGIN=true
- Ensure CHANGELOG.md is updated on main branch
- Push a tag to origin matching the version referenced in the changelog
- Follow the instructions in homebrew-cenv to ensure the new version is available via. homebrew