var NODE_ENV = process.env.NODE_ENV;

if ('OPENSHIFT_APP_NAME' in process.env) {
  // OpenShift (production) environment
  exports.ENVIRONMENT    = NODE_ENV || 'production';
  exports.SERVER_ADDRESS = process.env['OPENSHIFT_NODEJS_IP'];
  exports.SERVER_PORT    = process.env['OPENSHIFT_NODEJS_PORT'];
} else {
  // Local (development) environment
  exports.ENVIRONMENT    = NODE_ENV || 'development';
  exports.SERVER_ADDRESS = 'localhost';
  exports.SERVER_PORT    = 8080;
}

@@ -30,17 +30,460 @@
 DE_ENV;%0A
-%0A
+var npmConfig = function (name) %7B%0A  return process.env%5B'npm_package_config_' + name%5D;%0A%7D;%0Avar openshiftConfig = function (name) %7B%0A  return process.env%5B'OPENSHIFT_' + name%5D;%0A%7D;%0A%0Aif ('npm_package_config_override_config' in process.env) %7B%0A  // npm-overridden environment%0A  exports.ENVIRONMENT    = NODE_ENV %7C%7C npmConfig('environment');%0A  exports.SERVER_ADDRESS = npmConfig('host') %7C%7C undefined;%0A  exports.SERVER_PORT    = npmConfig('port');%0A%7D%0Aelse 
 if ('OPE
@@ -637,39 +637,33 @@
 DRESS = 
-process.env%5B'OPENSHIFT_
+openshiftConfig('
 NODEJS_I
@@ -664,17 +664,17 @@
 DEJS_IP'
-%5D
+)
 ;%0A  expo
@@ -694,39 +694,33 @@
 RT    = 
-process.env%5B'OPENSHIFT_
+openshiftConfig('
 NODEJS_P
@@ -723,17 +723,17 @@
 JS_PORT'
-%5D
+)
 ;%0A%7D else

Allow server config to be overridden through npm