Permalink
Browse files

Changed readme

  • Loading branch information...
Artem Skvira
Artem Skvira committed Oct 18, 2010
1 parent 0227709 commit e7d1a8a0a25946231a107fd12e04284b17a8e125
Showing with 53 additions and 0 deletions.
  1. +53 −0 README
View
53 README
@@ -0,0 +1,53 @@
+Lightweight configuration engine for node.js
+
+Allows you to have a common configuration file with an ability to override particular
+settings in host-specific configuratin files.
+
+For example, name of your application stays the same, i.e.
+
+conf/common.js:
+ exports.conf = {
+ name: 'My Super Awesome Kick Ass Startup'
+ }
+
+but the connection string to the database is different in case of
+CI/Dev/Production machines:
+
+conf/ci-hostname.js:
+ exports.conf = {
+ db_connection: 'ci.mongo-db.local'
+ }
+
+conf/my-dev.js:
+ exports.conf = {
+ db_connection: 'localhost'
+ }
+
+conf/linode.beefed-up.server.com.js:
+ exports.conf = {
+ db_connection: 'nosql-super-clustered-cloud-database'
+ }
+
+where ci-hostname/my-dev/linode.beefed-up.server.com are corresponding
+hostnames.
+
+Node-config will load common configuration values and then override them with
+appropriate values from host-specific config file.
+
+Loading of configuration is as simple as this:
+
+ var conf = require('node-config'),
+ sys = require('sys');
+
+ conf.initConfig(
+ function(err) {
+ if(err) {
+ sys.log('Unable to init the config: ' + err);
+ return;
+ }
+
+ // Config loaded, can do those things now:
+
+ console.log(conf.db_connection);
+ }
+ );

0 comments on commit e7d1a8a

Please sign in to comment.