Skip to content

maorhayoun/nconf-remote-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

remote http storage engine for nconf

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published