a nodejs module for supporting configeration
Want to see pretty graphs? Log in now!
npm install icnf
|4||downloads in the last week|
|17||downloads in the last month|
|Last Published By|
|Version||0.0.3 last updated a year ago|
|Keywords||simple, config, json|
icnf is a nodejs module for supporting configeration.
License: This project is under GPL/BSD
There already exists a module named
config, but for me, it is too large: i dont want supporting yml etc features, i just a simple solution.
So that's why i create this module. Certainly choice is in your mind.
How to install
npm install icnf
How to use
- create several config files under some directory in your project, for example:
<YOUR PROJECT> + etc/ + production.json + testing.json + development.json
according to your needs. The format should always be json format.
- use icnf in your code
var icnf = require('icnf')(__dirname); // app root directory, that is <YOUR PROJECT> var config = icnf(); // default is process.env.NODE_ENV || 'production', so it will auto use etc/production.json. var config = icnf('development'); // then, now it will choose etc/development.json
How to use idiff
There is also a tool named idiff under bin/ above v0.0.3. This tool only check the key in the config file. For example:
$ ../bin/idiff production checking /Users/yarco/Sites/js/icnf/test/etc/development.json - database.port - database.more.name ! database.more.port - keywords.1
Argument production is the standard config file in this example. (That means you may treat that file as a standard.) This file should be located in etc/ (etc/production.json).
- - means the key database.port is lost in development.json when comparing with production.json
- ! means type does't match
- Array like keywords here will always treat as an object.
- Key exists in development but not in production will be totally ignored.
- extend part won't be checked. cause it is used for common part
development to production (you could also add more files there, example: testing.json):
$ ../bin/idiff development checking /Users/yarco/Sites/js/icnf/test/etc/production.json - gf - database.more.kk ! database.more.port
- the config file is
- files in subdirectories under etc/ will be totally ignored when using idiff
- 0.0.1 to 0.0.3
- add idiff
- add extend feature for common part, see example under tests/
This guy currently works in Wiredcraft.com. So you could also get him by firstname.lastname@example.org
All rights reserved.