geoip-lite
Advanced tools
Comparing version 1.3.8 to 1.4.0
{ | ||
"name" : "geoip-lite", | ||
"version" : "1.3.8", | ||
"version" : "1.4.0", | ||
"description" : "A light weight native JavaScript implementation of GeoIP API from MaxMind", | ||
@@ -5,0 +5,0 @@ "keywords" : ["geo", "geoip", "ip", "ipv4", "ipv6", "geolookup", "maxmind", "geolite"], |
@@ -70,4 +70,6 @@ GeoIP-lite | ||
Run `cd node_modules/geoip-lite && npm run-script updatedb` to update the data files. | ||
Run `cd node_modules/geoip-lite && npm run-script updatedb license_key=YOUR_LICENSE_KEY` to update the data files. (Replace `YOUR_LICENSE_KEY` with your license key obtained from [maxmind.com](https://support.maxmind.com/account-faq/account-related/how-do-i-generate-a-license-key/)) | ||
You can create maxmind account [here](https://www.maxmind.com/en/geolite2/signup) | ||
**NOTE** that this requires a lot of RAM. It is known to fail on on a Digital Ocean or AWS micro instance. | ||
@@ -74,0 +76,0 @@ There are no plans to change this. `geoip-lite` stores all data in RAM in order to be fast. |
@@ -27,2 +27,8 @@ // fetches and converts maxmind lite databases | ||
var args = process.argv.slice(2); | ||
var license_key = args.find(function(arg) { | ||
return arg.match(/^license_key=[a-zA-Z0-9]+/) !== null; | ||
}); | ||
if (typeof license_key === 'undefined' && typeof process.env.LICENSE_KEY !== 'undefined') { | ||
license_key = 'license_key='+process.env.LICENSE_KEY; | ||
} | ||
var dataPath = path.join(__dirname, '..', 'data'); | ||
@@ -35,4 +41,5 @@ var tmpPath = path.join(__dirname, '..', 'tmp'); | ||
type: 'country', | ||
url: 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip', | ||
checksum: 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.md5', | ||
url: 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&suffix=zip&'+license_key, | ||
checksum: 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&suffix=zip.md5&'+license_key, | ||
fileName: 'GeoLite2-Country-CSV.zip', | ||
src: [ | ||
@@ -51,4 +58,5 @@ 'GeoLite2-Country-Locations-en.csv', | ||
type: 'city', | ||
url: 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip', | ||
checksum: 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.md5', | ||
url: 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City-CSV&suffix=zip&'+license_key, | ||
checksum: 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City-CSV&suffix=zip.md5&'+license_key, | ||
fileName: 'GeoLite2-City-CSV.zip', | ||
src: [ | ||
@@ -147,3 +155,3 @@ 'GeoLite2-City-Locations-en.csv', | ||
} | ||
var checksumUrl = database.checksum; | ||
@@ -161,5 +169,5 @@ | ||
} | ||
console.log('Checking ', database.fileName); | ||
console.log('Checking ', checksumUrl); | ||
function onResponse(response) { | ||
@@ -211,3 +219,3 @@ var status = response.statusCode; | ||
var downloadUrl = database.url; | ||
var fileName = downloadUrl.split('/').pop(); | ||
var fileName = database.fileName; | ||
var gzip = path.extname(fileName) === '.gz'; | ||
@@ -225,3 +233,3 @@ | ||
console.log('Fetching ', downloadUrl); | ||
console.log('Fetching ', fileName); | ||
@@ -263,3 +271,3 @@ function onResponse(response) { | ||
} | ||
if (path.extname(tmpFileName) !== '.zip') { | ||
@@ -625,2 +633,7 @@ cb(null, database); | ||
if (!license_key) { | ||
console.log('ERROR'.red + ': Missing license_key'); | ||
process.exit(1); | ||
} | ||
rimraf(tmpPath); | ||
@@ -627,0 +640,0 @@ mkdir(tmpPath); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115396319
1325
230
9