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.

Updated next config.

Mike Caod1765f746b96
diff --git a/lib/request.js b/lib/request.js
index 6975c170d..15ab57228 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -3,6 +3,9 @@ import requestIp from 'request-ip';
import { browserName, detectOS } from 'detect-browser';
import isLocalhost from 'is-localhost-ip';
import maxmind from 'maxmind';
+import getConfig from 'next/config';
+const { serverRuntimeConfig } = getConfig();
+
import {
DESKTOP_OS,
MOBILE_OS,
@@ -60,7 +63,9 @@ export async function getCountry(req, ip) {
}
// Database lookup
- const lookup = await maxmind.open(path.resolve(__dirname, '../geo/GeoLite2-Country.mmdb'));
+ const lookup = await maxmind.open(
+ path.resolve(serverRuntimeConfig.PROJECT_ROOT, '../geo/GeoLite2-Country.mmdb'),
+ );
const result = lookup.get(ip);
diff --git a/next.config.js b/next.config.js
index 0ddfc76a4..c1e31d7b9 100644
--- a/next.config.js
+++ b/next.config.js
@@ -5,6 +5,9 @@ module.exports = {
env: {
VERSION: pkg.version,
},
+ serverRuntimeConfig: {
+ PROJECT_ROOT: __dirname,
+ },
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
diff --git a/package.json b/package.json
index d615260de..a82cf4dea 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "0.57.0",
+ "version": "0.58.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <[email protected]>",
"license": "MIT",