node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



fconfig is a minimal configuration library for node.js, inspired by the config class of the ZEND PHP framework.

It allows multi-environment configurations to be read from either static .JSON-files or dynamic .js & .coffee-files.

By organising your configuration in environment-specific blocks and configuring fconfig accordingly, you only have to write minimal configuration as non-default configurations automatically base themselves upon the default environment.

Ie. anything that is declared in development is automatically extended to other environments such as production when development is set as your default environment. (See example below)

Example configuration

module.exports = 
	# /configs/
	  sendEmails: false
	    host: ""

	  # Just do "config.get "advancedStuff" and your closure is invoked
	  # automatically!
	  getAdvancedStuff: -> returnMath.random() + 10
	# This block will extend the above "development" block so only
	# specify what needs to differ here
	    host: ""

	fconfig = require "fconfig"
	config =  new fconfig
	  config:      ""
	  env_default: "development" # Set the development-block as default

See the example/ file for more details.


npm install fconfig


See LICENSE file.

Copyright (c) 2012 Joakim B