Skip to content

Commit

Permalink
HOSTNAME and HOST precedence
Browse files Browse the repository at this point in the history
The HOSTNAME and HOST ENV variables now take precedence over OS.hostname()
  • Loading branch information
jscharlach committed Nov 6, 2012
1 parent dd726e5 commit 5060b04
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/config.js
Expand Up @@ -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;

Expand Down

0 comments on commit 5060b04

Please sign in to comment.