From c6a74b66ce6946337b6031f607fee2fc4c0d965f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 8 Jun 2018 13:46:42 +0200 Subject: [PATCH] Use external module to get full qualified domain name properly --- lib/cartodb/server_options.js | 5 ++--- package.json | 1 + yarn.lock | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index dff1280e..78036f0d 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -1,4 +1,4 @@ -var os = require('os'); +const fqdn = require('@carto/fqdn-sync'); var _ = require('underscore'); var OverviewsQueryRewriter = require('./utils/overviews_query_rewriter'); @@ -36,8 +36,7 @@ rendererConfig.mapnik.queryRewriter = overviewsQueryRewriter; // See https://github.com/CartoDB/Windshaft-cartodb/issues/153 if (global.environment.statsd) { if (global.environment.statsd.prefix) { - var host_token = os.hostname().split('.').reverse().join('.'); - global.environment.statsd.prefix = global.environment.statsd.prefix.replace(/:host/, host_token); + global.environment.statsd.prefix = global.environment.statsd.prefix.replace(/:host/, fqdn.reverse()); } } diff --git a/package.json b/package.json index 488b59c3..38eb91d7 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "Simon Martin " ], "dependencies": { + "@carto/fqdn-sync": "0.2.1", "basic-auth": "2.0.0", "body-parser": "1.18.3", "camshaft": "0.61.10", diff --git a/yarn.lock b/yarn.lock index 4f98787a..fd0224c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,10 @@ # yarn lockfile v1 +"@carto/fqdn-sync@0.2.1": + version "0.2.1" + resolved "https://registry.yarnpkg.com/@carto/fqdn-sync/-/fqdn-sync-0.2.1.tgz#cd7428380c4411d523ff8f228f77affb25a5d0be" + "@carto/mapnik@3.6.2-carto.10": version "3.6.2-carto.10" resolved "https://registry.yarnpkg.com/@carto/mapnik/-/mapnik-3.6.2-carto.10.tgz#a97c951dcdac09d0eb35b3ea71e5eeaa206c1af6" @@ -11,7 +15,7 @@ node-pre-gyp "0.10.0" protozero "1.5.1" -"@carto/tilelive-bridge@github:cartodb/tilelive-bridge#2.5.1-cdb9": +"@carto/tilelive-bridge@cartodb/tilelive-bridge#2.5.1-cdb9": version "2.5.1-cdb9" resolved "https://codeload.github.com/cartodb/tilelive-bridge/tar.gz/5129e43223cb55daed31373c7a36c98eb6178fc1" dependencies: @@ -23,7 +27,7 @@ version "1.0.5" resolved "https://registry.yarnpkg.com/@mapbox/sphericalmercator/-/sphericalmercator-1.0.5.tgz#70237b9774095ed1cfdbcea7a8fd1fc82b2691f2" -"abaculus@github:cartodb/abaculus#2.0.3-cdb10": +abaculus@cartodb/abaculus#2.0.3-cdb10: version "2.0.3-cdb10" resolved "https://codeload.github.com/cartodb/abaculus/tar.gz/90d537028bb8af8a35e7a40c46493066dd8a76b3" dependencies: @@ -272,7 +276,7 @@ camshaft@0.61.10: dot "^1.0.3" request "2.85.0" -"canvas@github:cartodb/node-canvas#1.6.2-cdb2": +canvas@cartodb/node-canvas#1.6.2-cdb2: version "1.6.2-cdb2" resolved "https://codeload.github.com/cartodb/node-canvas/tar.gz/8acf04557005c633f9e68524488a2657c04f3766" dependencies: @@ -290,17 +294,17 @@ carto@0.16.3: semver "^5.1.0" yargs "^4.2.0" -carto@cartodb/carto#master: - version "0.15.1" - resolved "https://codeload.github.com/cartodb/carto/tar.gz/31abb8bee02df605521247b0223d508320f7d4c8" +carto@cartodb/carto#0.15.1-cdb3: + version "0.15.1-cdb3" + resolved "https://codeload.github.com/cartodb/carto/tar.gz/945f5efb74fd1af1f5e1f69f409f9567f94fb5a7" dependencies: mapnik-reference "~6.0.2" optimist "~0.6.0" underscore "1.8.3" -"carto@github:cartodb/carto#0.15.1-cdb3": - version "0.15.1-cdb3" - resolved "https://codeload.github.com/cartodb/carto/tar.gz/945f5efb74fd1af1f5e1f69f409f9567f94fb5a7" +carto@cartodb/carto#master: + version "0.15.1" + resolved "https://codeload.github.com/cartodb/carto/tar.gz/31abb8bee02df605521247b0223d508320f7d4c8" dependencies: mapnik-reference "~6.0.2" optimist "~0.6.0" @@ -1885,7 +1889,7 @@ pg-types@1.*: postgres-date "~1.0.0" postgres-interval "^1.1.0" -"pg@github:CartoDB/node-postgres#6.4.2-cdb1": +pg@CartoDB/node-postgres#6.4.2-cdb1: version "6.4.2" resolved "https://codeload.github.com/CartoDB/node-postgres/tar.gz/449fac1d6da711ffcc6694ae3c89f85244f48bdc" dependencies: @@ -2614,7 +2618,7 @@ through@2: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" -"tilelive-mapnik@github:cartodb/tilelive-mapnik#0.6.18-cdb14": +tilelive-mapnik@cartodb/tilelive-mapnik#0.6.18-cdb14: version "0.6.18-cdb14" resolved "https://codeload.github.com/cartodb/tilelive-mapnik/tar.gz/6d06f728833d3e34d1adcd05567b3f4379f547bb" dependencies: