envcrypt is an encrypt/decrypt CLI tool that was built for the purpose of storing encrypted (AES-256) .env files in version control. By default, envcrpyt will take any .env files and create an encrypted .envcrypt file. The unencrypted .env files should not be committed to version control. The .envcrypt file can be. When checking out a repository with an
- Add @jaketig/envcrypt as a dev dependency
npm install @jaketig/envcrypt --save-dev
- Use the CLI
envcrypt <command>
Command | Alias | Description |
---|---|---|
|
|
Encrypt the contents of .env files |
|
|
Decrypt the contents of .envcrypt file to original files |
Option | Alias | Description |
---|---|---|
|
Encryption key used to encrypt/decrypt contents. Optional, will prompt if not passed. Can also store key in .envcrypt.key file - this should be added to .gitignore |
Bare Minimum Encryption
envcrypt e
- will prompt for secret key
- will encrypt
.env
to.envcrypt
Bare Minimum Decryption
envcrypt d
- will prompt for secret key
- will decrypt
.envcrypt
to.env
Pass Key
envcrypt d --key=supersecret
- will decrypt
.envcrypt
to.env