@andrewiski/confighandler
v1.0.4
Published
Tool to assist with config files
Downloads
5
Readme
ConfigHandler
Node.js Config file helper Class
Install ''' npm install @andrewiski/confighandler '''
''' 'use strict'; const path = require('path');
//set Enviroment DEBUG=confighandler, app to see console output var ConfigHandler = require('configHandler');
var myAppDefaultConfig = { dbConnectionString:"sampleDbConnectionString", appEmailAddress:"[email protected]", version: 0
}
var configHandler = new ConfigHandler( { configFileName: 'config.json', configDirectory: path.join(__dirname,'config'), readConfigOnCreate: true },
myAppDefaultConfig
);
console.log("Config", configHandler.config);
configHandler.config.version++; configHandler.config.appEmailAddress = "updated" + configHandler.config.version + "@example,com";
configHandler.configFileSave();
console.log("Config", configHandler.config);
'''