make geoip lookup optional

This commit is contained in:
Danny Coates 2020-01-11 14:06:17 -08:00
parent 43c728d5d4
commit 097d3c8377
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 9 additions and 1 deletions

View File

@ -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) {

View File

@ -149,6 +149,11 @@ const conf = convict({
format: String,
default: '',
env: 'SURVEY_URL'
},
ip_db: {
format: String,
default: '',
env: 'IP_DB'
}
});