Using CSON with nconf (nodejs)

nconf for nodejs offers hierarchical configuration with files, environment variables, command-line arguments, and atomic object merging. Out of the box, nconf supports JSON and ini file formats. Getting nconf to support custom formats, e.g. CSON is straightforward: provide a format handler as an option to nconf.

nconf.file file : "somefile.cson", format : { stringify : cson.stringifySync, parse : cson.parseSync }

See gist for a longer example.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s