Permalink
Browse files

HOSTNAME and HOST precedence

The HOSTNAME and HOST ENV variables now take precedence over OS.hostname()
  • Loading branch information...
1 parent dd726e5 commit 5060b04a4f962ab9ee17eba0c440a46e16b4898b @jscharlach jscharlach committed Nov 6, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/config.js
View
@@ -578,10 +578,14 @@ Config.prototype._loadFileConfigs = function() {
// Determine the host name from the OS module, $HOST, or $HOSTNAME
// Remove any . appendages, and default to null if not set
try {
- var OS = require('os');
- var hostName = OS.hostname();
+ var hostName = process.env.HOST || process.env.HOSTNAME;
+
+ if (!hostName) {
+ var OS = require('os');
+ hostName = OS.hostname();
+ }
} catch (e) {
- hostName = process.env.HOST || process.env.HOSTNAME;
+ hostName = '';
}
hostName = hostName ? hostName.split('.')[0] : null;

0 comments on commit 5060b04

Please sign in to comment.