Handle environment configs on mongo database to be shared across multiple microservices
$ npm install --save config-registry
const ConfigRegistry = require('config-registry');
var configRegistry = new ConfigRegistry({
env: 'dev',
collection: '<registyCollectionName>',
name: '<configName>',
db: {
url: '<mongoCnxString>'
}
});
configRegistry
.getConfig()
.then((config) => {
// use config object config.<key>
})
.catch((error) => {
// handle error
});
MIT © Helmac.ca