From 097d3c8377ee15009464e35da45e857593246e35 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Sat, 11 Jan 2020 14:06:17 -0800 Subject: [PATCH] make geoip lookup optional --- server/amplitude.js | 5 ++++- server/config.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/server/amplitude.js b/server/amplitude.js index bb1ebcec..787026f5 100644 --- a/server/amplitude.js +++ b/server/amplitude.js @@ -1,9 +1,12 @@ const crypto = require('crypto'); -const geoip = require('fxa-geodb')(); const fetch = require('node-fetch'); const config = require('./config'); const pkg = require('../package.json'); +const geoip = config.ip_db + ? require('fxa-geodb')({ dbPath: config.ip_db }) + : () => ({}); + const HOUR = 1000 * 60 * 60; function truncateToHour(timestamp) { diff --git a/server/config.js b/server/config.js index 55cefc62..72b750ea 100644 --- a/server/config.js +++ b/server/config.js @@ -149,6 +149,11 @@ const conf = convict({ format: String, default: '', env: 'SURVEY_URL' + }, + ip_db: { + format: String, + default: '', + env: 'IP_DB' } });