Config class for json configuration files. Support simple structure of ini configuration.

Load and merge configuration files in js (need to export using module.exports). Can read simple ini format file and convert it to object.

var Config = require('vnfconfig').Config;
var c = new Config(['all.js', 'production.js'], __dirname + '/config');
console.log(; // output
console.log(c.port); // output 8000


module.exports = {
    'host' : '',
    'port' : 3000


module.exports = {
    'port': 8000
  • files array of configuration filenames
  • path path to files given above

Override obj with properties in source1, source2 and so on

Override a property in obj. Adding property if it does not exist

  • obj object to override
  • prop name of property to override
  • value value of the property
  • filename
  • callback(Error, Config) passing Config if success

Sync version of ini2json

  • filename
  • Return Config

Create a string in ini-format of the given obj

  • obj object to create ini-formatted string
  • Return ini-formatted string

Scan entire directory for configuration files with extension .js Those files need to export an object of configurations

  • path path of the directory to scan for configurations
  • Return Config