Use external module to get full qualified domain name properly
This commit is contained in:
parent
162aae47f7
commit
d7e24f7745
7
app.js
7
app.js
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var os = require('os');
|
const fqdn = require('@carto/fqdn-sync');
|
||||||
|
|
||||||
var argv = require('yargs')
|
var argv = require('yargs')
|
||||||
.usage('Usage: $0 <environment> [options]')
|
.usage('Usage: $0 <environment> [options]')
|
||||||
@ -46,7 +46,7 @@ if (availableEnvironments.indexOf(ENVIRONMENT) === -1) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
global.settings.api_hostname = require('os').hostname().split('.')[0];
|
global.settings.api_hostname = fqdn.hostname();
|
||||||
|
|
||||||
global.log4js = require('log4js');
|
global.log4js = require('log4js');
|
||||||
var log4jsConfig = {
|
var log4jsConfig = {
|
||||||
@ -85,8 +85,7 @@ var StatsClient = require('./app/stats/client');
|
|||||||
if (global.settings.statsd) {
|
if (global.settings.statsd) {
|
||||||
// Perform keyword substitution in statsd
|
// Perform keyword substitution in statsd
|
||||||
if (global.settings.statsd.prefix) {
|
if (global.settings.statsd.prefix) {
|
||||||
var hostToken = os.hostname().split('.').reverse().join('.');
|
global.settings.statsd.prefix = global.settings.statsd.prefix.replace(/:host/, fqdn.reverse());
|
||||||
global.settings.statsd.prefix = global.settings.statsd.prefix.replace(/:host/, hostToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var statsClient = StatsClient.getInstance(global.settings.statsd);
|
var statsClient = StatsClient.getInstance(global.settings.statsd);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"Sandro Santilli <strk@vizzuality.com>"
|
"Sandro Santilli <strk@vizzuality.com>"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@carto/fqdn-sync": "0.2.1",
|
||||||
"basic-auth": "^2.0.0",
|
"basic-auth": "^2.0.0",
|
||||||
"bintrees": "1.0.1",
|
"bintrees": "1.0.1",
|
||||||
"bunyan": "1.8.1",
|
"bunyan": "1.8.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user