Global config files for cli apps helper
npm install --save homeconfjs
The file will be created automatically, named packageName.json
at the path homeConf.path
that may varies depending on the current OS.
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf(); // Default: {}
Or
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf({defaultObject}); // Specify the default object
Or
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf(`${__dirname}/default.json`); // Use the file as default
Get the actual config object.
homeConf.config
Get the path of the config file
homeConf.path
Get a value by its object path.
homeConf.get('user.name')
Set and save a value by its object path.
homeConf.get('user.name', 'Anas')
This project is under the MIT license.