A simple CLI tool to manage environment variables for your project and prevent you from pushing .env files into production by accident.
Envy is a simple CLI tool to safely store and recover .env
files for projects. It's written in Go using the cobra
cli tool and lipgloss
for styling.
Envy uses an AES encryption to store your environment variables in a .pack
file which you can unpack as you like. Envy also removes the .env file from the given folder and replaces it with a placeholder .env-dist
file, once it's packed as it's generally not a good practice to push them onto repos.
Head on over to the Releases page to pickout the release that best fits your requirements and add it to your computer's bin
(/usr/bin
or /usr/local/bin
)
curl -L https://github.com/softmaxer/envy/releases/download/v0.1.6/envy_Darwin_arm64.tar.gz > envy.tar.gz
tar -xzvf envy.tar.gz
Once installed, Either add the path to the $PATH
variable or move it to bin
(might require sudo):
mv envy /usr/local/bin/envy
Or, you can also install it with go:
go install github.com/softmaxer/envy
-
Start a new envy vault by typing
envy new
This will start a new fault in your
$HOME
under the directory.envy
. -
Once a vault is setup, headover to any git repo / project folder which contains an env file and type:
envy pack
This should encrypt your environment variables in your vault. The project name under which the file is encrypted will be the name of your current directory. If you want to change, that:
envy pack <project-name>
This will also remove the env file from the current directory to make sure your code is safe to be pushed onto a repositorty.
-
to unpack, Just simply type:
envy unpack
Or with a project name:
envy unpack <project-name>
Copy the following snippet into your .pre-commit-config.yaml
repos:
- repo: https://github.com/softmaxer/envy
rev: v0.2.12
hooks:
- id: envy-new
- id: envy-pack
NOTE: This will make your pre-commit hook fail if you have the .env file tracked by git. This is expected behavior. However, the program itself will succeed if it finds an env i.e., it will still hash your env into a vault and replace it with an env-dist