0.0.4 • Published 8 years ago

nconf-remote-http v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

nconf-remote-http

Build Status

storage engine extention for serving json configuration files via http/s

Install

$ npm install nconf-remote-http --save

Setup

In 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.

asynchronous mode

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'));
  }
});

Synchronous mode

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'))
0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago