dynconfig
v1.0.3
Published
Dynamic configuration for nodejs application
Downloads
2
Readme
Dynconfig
Dynamic configuration for nodejs application
Installation
npm install dynconfig
Usage example
Create dynamic configuration file as “config\dynamic.json” in your project.
JSON
{ "Cache": { "SlidingExpiry": "10" }, "SampleData": { "slidingexpiry": 1, "pagesize": 5, "enable": true, "servers": [ { "item": "abc" }, { "item": "xyz" } ] } }
Code
var dynconfig = require('dynconfig');
console.log(dynconfig.Item('Cache/SlidingExpiry')); console.log(dynconfig.Items(' SampleData/servers));
Options
- Item (Get configuration value for specified key as string)
- Items (Get configuration values for specified key as collection)
- ItemWithDefault (Get configuration value for specified key as string and return default value, if specified key doesn’t match)
- ItemAsBoolean (Get configuration value for specified key as Boolean)
- ItemAsNumber (Get configuration value for specified key as number)