brpaz
7/30/2016 - 1:40 PM

Example of loading configurations into a nodeJS / Express application

Example of loading configurations into a nodeJS / Express application


// Load Environment variables from .env file
require('dotenv').load();

// Set up configs
nconf.use('memory');
// First load command line arguments
nconf.argv();
// Load environment variables
nconf.env();
// Load config file for the environment
require('./config/environments/' + nconf.get('NODE_ENV'));