Skip to content

Commit

Permalink
Support end-user license agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Shirokov committed Jan 1, 2020
1 parent 79a8dbf commit 02ac97b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/postinstall.js
Expand Up @@ -4,10 +4,22 @@ const zlib = require("zlib");
const path = require("path");
const tar = require("tar");

const licenseKey = process.env.MAXMIND_LICENSE_KEY;
if (!licenseKey) {
console.error(`Error: License key is not configured.\n
You need to signup for a _free_ Maxmind account to get a license key.
Go to https://www.maxmind.com/en/geolite2/signup, obtain your key and
put it in the MAXMIND_LICENSE_KEY environment variable\n`);
process.exit(1);
}

const link = edition =>
`https://download.maxmind.com/app/geoip_download?edition_id=${edition}&license_key=${licenseKey}&suffix=tar.gz`;

const links = [
"https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz",
"https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz",
"https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz"
link('GeoLite2-City'),
link('GeoLite2-Country'),
link('GeoLite2-ASN'),
];

const downloadPath = path.join(__dirname, "..", "dbs");
Expand Down

0 comments on commit 02ac97b

Please sign in to comment.