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 crypto = require('crypto');
const geoip = require('fxa-geodb')();
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const config = require('./config'); const config = require('./config');
const pkg = require('../package.json'); const pkg = require('../package.json');
const geoip = config.ip_db
? require('fxa-geodb')({ dbPath: config.ip_db })
: () => ({});
const HOUR = 1000 * 60 * 60; const HOUR = 1000 * 60 * 60;
function truncateToHour(timestamp) { function truncateToHour(timestamp) {

View file

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