domain-config-local

domain

#OBJECTIVE: Configuration service client helper.

#DESCRIPTION:
This module will help you to query the configuration and keep cache of the results, Next time you query the module it will use the cache. This module supports an update event lisener, if the configuration database will change the module will update the cached data, next time you will query the module the data will be up-to-date.

The module contains the following functions: config.getSingle(tgInfo, 'key') - return single configuration in promise pattern. get(tgInfo, ['keys']) - return configuration object.

#INSTALLATION

npm install domain-config-local

#config.getSingle USEAGE EXAMPLE:

var config = require('domain-config-local');
var tgInfo = { storeId: 1, langId: 1 };
config.getSingle(tgInfo, 'key')
     .then(function(val){
          console.log(val);
     });
 
// logs the log value
 

#config.get USEAGE EXAMPLE:

var config = require('domain-config-local');
var tgInfo = { storeId: 1, langId: 1 };
config.get(tgInfo, ['key1', 'key2'])
     .then(function(val){
          console.log(val);
     });
 
// logs the value:
// {
//     key1: 'some value',
//     key2: 'some value2'
// }