Skip to content
This repository

Runtime configuration for node.js modules

This branch is 0 commits ahead and 157 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 node_modules
Octocat-spinner-32 test
Octocat-spinner-32 tools Made watchForConfigChanges public and updated docs August 02, 2011
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.md
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

node-config

Configuration control for production node deployments

Introduction

Node-config is a configuration system for Node.js application server deployments. It lets you define a default set of application parameters, and tune them for different runtime environments (development, qa, staging, production, etc.).

Parameters defined by node-config can be monitored and tuned at runtime without bouncing your production servers.

Online documentation is available at http://lorenwest.github.com/node-config/latest

Quick Start

In your project directory, install and verify using npm:

my-project$ npm install config
my-project$ npm test config

Edit the default configuration file (.js, .json, or .yaml):

my-project$ mkdir config 
my-project$ vi config/default.yaml

(example default.yaml file):

Customer:
  dbHost: localhost
  dbPort: 5984
  dbName: customers

Edit the production configuration file:

my-project$ vi config/production.yaml

(example production.yaml file):

Customer:
  dbHost: prod-db-server

Use the configuration in your code:

var CONFIG = require('config').Customer;
...
db.connect(CONFIG.dbHost, CONFIG.dbPort, CONFIG.dbName);

Start your application server:

my-project$ export NODE_ENV=production
my-project$ node app.js

Running in this configuration, CONFIG.dbPort and CONFIG.dbName will come from the default.yaml file, and CONFIG.dbHost will come from the production.yaml file.

See Also

node-config - Online documentation
node-monitor - Monitor your running node applications

License

Released under the Apache License 2.0

See LICENSE file.

Copyright (c) 2011 Loren West

Something went wrong with that request. Please try again.