Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fix geo lookup for Netlify.

Mike Caod3f5f42d0264
diff --git a/lib/request.js b/lib/request.js
index 210921b98..cb9abc7b5 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -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';
@@ -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);
diff --git a/netlify.toml b/netlify.toml
index 51e90db9f..0d8c6fc18 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,2 +1,2 @@
[functions]
-included_files = ["node_modules/.geo/*.mmdb"]
+included_files = ["node_modules/.geo/**"]