adonis-secrets
v0.1.3
Published
AdonisJS secrets manager. Store safely your credentials in your repository.
Downloads
88
Maintainers
Readme
adonis-secrets
Safely store your AdonisJS environment variables in your repositories
🔨 Install • 🚀 Get started • 🔧 Environments
Introduction
This AdonisJS library allows you to safely store your environment variable files in your repository by bringing two commands env:encrypt
and env:decrypt
. It is heavily inspired by the popular framework Laravel.
🔨 Install
node ace add adonis-secrets
🚀 Get started
You can encrypt your local environment file (.env
) by using the env:encrypt
command.
It will create a new file .env.encrypted
node ace env:encrypt
And then decrypt it using env:decrypt
.
APP_KEY=myappkey node ace env:decrypt
Under the hood, your files are encrypted using the
APP_KEY
environment variable. When decrypting a file the variable might not be available (as it might be inside the encrypted file). When it is the case, you have to provide it manually.
🔧 Environments
You might want to store the environment variables of other environments. You can do this by simply using the NODE_ENV
variable. This will encrypt/decrypt your .env.[environment]
file.
NODE_ENV=staging APP_KEY=myappkey node ace env:encrypt
NODE_ENV=staging APP_KEY=myappkey node ace env:decrypt
When providing development
or nothing it will default to the .env
file.
⚠ For security reasons, make sure you a different key for each environment.
Contributing
I'd love for you to contribute to this project. You can request new features by creating an issue, or submit a pull request with your contribution.