Node.js Configuration

Node.js Configuration > config
Search:
 
Filters

Module: config

Runtime Application Configurations

The config module exports a singleton object representing all runtime configurations for this application deployment.

Application configurations are stored in files within the config directory of your application. The default configuration file is loaded, followed by files specific to the deployment type (development, testing, staging, production, etc.).

For example, with the following config/default.yaml file:

...
customer:
  initialCredit: 500
  db:
    name: customer
    port: 5984
...

The following code loads the customer section into the CONFIG variable:

var CONFIG = require('config').customer;
...
newCustomer.creditLimit = CONFIG.initialCredit;
database.open(CONFIG.db.name, CONFIG.db.port);
...

This module contains the following classes:


Released on github under the Apache License 2.0 version 0.4.32