Skip to content

Commit

Permalink
ensure file before trying to read it...somehow this shows up as a dir…
Browse files Browse the repository at this point in the history
… (no idea why) but fixes #20
  • Loading branch information
leeliu committed May 19, 2017
1 parent eb13d1a commit 9a5d3a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ checkElevated()

// debug(console.log(config));

config.hostname = process.env.LOGDNA_HOSTNAME || fs.existsSync('/etc/logdna-hostname') && fs.readFileSync('/etc/logdna-hostname').toString().trim().replace(HOSTNAME_IP_REGEX, '') || config.hostname || os.hostname().replace('.ec2.internal', '');
config.hostname = process.env.LOGDNA_HOSTNAME || fs.existsSync('/etc/logdna-hostname') && fs.statSync('/etc/logdna-hostname').isFile() && fs.readFileSync('/etc/logdna-hostname').toString().trim().replace(HOSTNAME_IP_REGEX, '') || config.hostname || os.hostname().replace('.ec2.internal', '');
config.tags = process.env.LOGDNA_TAGS || config.tags;

if (process.env.LOGDNA_PLATFORM) {
Expand Down

0 comments on commit 9a5d3a6

Please sign in to comment.