Skip to content

vaikava/fconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fconfig

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/config.coffee
	development: 
	  sendEmails: false
	  database:
	    host: "127.0.0.1"

	  # 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
	production:
	  database:
	    host: "192.168.1.30"

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

See the example/app.coffee file for more details.

Installation

npm install fconfig

License

See LICENSE file.

Copyright (c) 2012 Joakim B

About

Featherlight config handler for node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published