@creative-realities/config
v1.0.0
Published
Configuration loader
Readme
config
ABOUT
Loads configuration files typically used in Reflect node.js applications depending on the local environment. Returns an object containing the configuration file's contents, otherwise null on failure to load.
The configuration file to load is derived from two environment variables:
NODE_ENV - Set by the system administrator or developer before launching the node.js project. Can have the values: dev, prod or debug. USER - If NODE_ENV has been set to 'dev' this module will query the USER environment variable for a particular developer's configuration file. LOGNAME - Alternative field to USER on *nix systems which use it.
For example, if NODE_ENV is set to 'prod' then the file ./config/prod.js will be loaded. If NODE_ENV is set to 'dev' and USER (or LOGNAME) is set to 'hodor' then the file ./config/hodor.js will be loaded.
USAGE
var config = require('config') var config = require('config')('config_dir'); var config = require('config')('config_dir', 'config_name')
Where config_dir and config_name override the default behaviour by setting explicit configuration file locations. For example:
var config = require('config')('configurations', 'hodor')
shall load the file: ./configurations/hodor.js
DEPENDENCIES
fs path minimist
