storage engine extention for serving json configuration files via http/s
$ npm install nconf-remote-http --saveIn order to setup and use nconf-remote-http consider the following example script. It initializes nconf with http storage engine which accepts url and callback function which exposes the json content.
Additional config retrievals can be done via nconf.get accessor method.
var nconf = require('nconf');
require('nconf-remote-http');
nconf.use('http', { url: 'http://jsonplaceholder.typicode.com/posts/1',
callback: function (data) {
console.log(nconf.get('title'));
}
});This flow relies on sync-request which spawns a worker process in order to make the http request synchronous. consider using it for service initialization flow. either way, use with caution.
nconf.use('http', { url: 'http://jsonplaceholder.typicode.com/posts/1' });
console.log(nconf.get('title'))