Merge pull request #1 from maechi/use-env-hostname-not-/etc/hostname

use hostname binary if we don't find an /etc/hostname
This commit is contained in:
maechi 2018-08-15 16:26:50 +02:00 committed by GitHub
commit 6d6f35d69a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
app.js
View File

@ -109,7 +109,11 @@ global.socket_clients = 0;
/**
* Server hostname
*/
global.host_name = execSync("cat /etc/hostname").toString().replace("\n", "");
try {
global.host_name = execSync("cat /etc/hostname").toString().replace("\n", "");
} catch (e) {
global.host_name = execSync("/usr/bin/env hostname -s").toString().replace("\n", "");
}
/**
* Pull in core handlers