1.7.0 • Published 2 years ago
envcredstash v1.7.0
Load credstash secrets into environment variables.
This project is inspired by envconsul.
Installation
sudo npm i -g envcredstashUsage
Start by storing some secrets with credstash as follows:
credstash put application/DB_PASSWORD my-db-password
credstash put application/MAIL_PASSWORD my-mail-passwordThen you can run your application as follows:
envcredstash --prefix application/ -- myapplicationExample:
envcredstash --prefix application/ -- python -c "import os; print os.environ['MAIL_PASSWORD']"
my-mail-passwordRunning env:
envcredstash --prefix application/ -- env
DB_PASSWORD=my-db-password
MAIL_PASSWORD=my-mail-passwordYou can also print the variables with the export clause, this is useful to source:
source <(envcredstash --prefix application/ --export)
python -c "import os; print os.environ['MAIL_PASSWORD']"
my-mail-passwordFull list of arguments
envcredstash --help
Options:
--table The credstash table. [default: "credential-store"]
--prefix The credstash prefix for keys. [array] [default: [""]]
--region The credstash region.
--export Export variables syntax. [boolean]
--list Export variables syntax. [boolean]
--help Show help [boolean]As a library
const envcredstash = require('envcredstash');
envcredstash.get({
prefixes: ['application/'],
// table:
// region:
}, (err, envs) => {
console.dir(envs);
//{
// DB_PASSWORD: "my-db-password"
// MAIL_PASSWORD: "my-mail-password"
//}
});License
MIT 2017 - José F. Romaniello