Skip to content

Instantly share code, notes, and snippets.

@JBreit
Created March 14, 2017 00:42
Show Gist options
  • Save JBreit/58bbddcda905b7f2bacabfaf4aa935e5 to your computer and use it in GitHub Desktop.
Save JBreit/58bbddcda905b7f2bacabfaf4aa935e5 to your computer and use it in GitHub Desktop.
Part of an experimental Node.js configuration file
var normalizePort = require('./../../utils').normalizePort,
_defaults = [
/*"NODE_ENV",*/
"HOST",
"PORT"
];
_defaults.forEach(function (name) {
'use strict';
if (!process.env[name]) {
throw new Error('Environment variable ' + name + ' is missing');
}
});
var config = {
env: process.env.NODE_ENV,
server: {
host: process.env.HOST || 'http://127.0.0.1',
port: normalizePort(process.env.PORT || 8080)
}
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment