figgy
v0.0.0
Published
A simple config file library
Downloads
1
Readme
Figgy
Just a simple module to do configuration files my way, without having to copy/paste from the same project hundreads of times. Not designed for any use cases other than my own.
Installation
npm install figgy
Usage
All configs are loaded in a config object stored on the figgy module.
//basic usage
var figgy = require('figgy')
var config = figgy.load('main', process.argv[2] || 'config.json')
As long as figgy.load has been run, you can use figgy.get('main')
in any
other module and retrieve the contents of the 'main' config
figgy.load(name, filename, chdir, filter)
Arguments
name
: The name of the config you want to set the config tofilename
: The filename of the config. This gets required, so anychdir
(optional): Chdir to the path relative to the config file. This can be useful since if you have paths in your config, they will most likely be relative to the config file itself, rather than the executable path (defaults to false)filter
(optional): Any post-config processing can be done in this callback
figgy.set(name, config, filter)
Arguments
name
: The name of the config you want to set the config toconfig
: A variable which to set the config tofilter
(optional): Any post-config processing can be done in this callback
figgy.get(name)
Returns the config associated with the name passed
Arguments:
name
: The name of the config you want to retrieve