Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
make geoip lookup optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Jan 11, 2020
1 parent 43c728d commit 097d3c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/amplitude.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ const conf = convict({
format: String,
default: '',
env: 'SURVEY_URL'
},
ip_db: {
format: String,
default: '',
env: 'IP_DB'
}
});

Expand Down

0 comments on commit 097d3c8

Please sign in to comment.