Lightweight helper library to fetch environment variables from Mongodb and set these in project.
Using npm:
$ npm install fetch-mongo-envs
(async() => {
const { Env } = require('fetch-mongo-envs');
const env = new Env(yourMongoUri, yourModel || 'environments', codebase || 'project-name', envType || 'production');
await env.build();
})()
Document schema should be like this:
{
codebase: "project-name",
envType: "production",
envs: {
FOO: "",
BAR: "",
...
}
}