Skip to content

Commit

Permalink
Fix geo lookup for Netlify.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Aug 23, 2022
1 parent 131a096 commit d3f5f42
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import path from 'path';
import requestIp from 'request-ip';
import { browserName, detectOS } from 'detect-browser';
import isLocalhost from 'is-localhost-ip';
Expand Down Expand Up @@ -68,7 +67,7 @@ export async function getCountry(req, ip) {

// Database lookup
if (!lookup) {
lookup = await maxmind.open(path.resolve('node_modules/.geo/GeoLite2-Country.mmdb'));
lookup = await maxmind.open('./node_modules/.geo/GeoLite2-Country.mmdb');
}

const result = lookup.get(ip);
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[functions]
included_files = ["node_modules/.geo/*.mmdb"]
included_files = ["node_modules/.geo/**"]

0 comments on commit d3f5f42

Please sign in to comment.