chore: allow custom geolite database path

This commit is contained in:
undefined 2025-06-05 17:34:09 +01:00 committed by GitHub
parent 65f3628ed7
commit 826f29bbc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,7 +124,7 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI
if (!global[MAXMIND]) {
const dir = path.join(process.cwd(), 'geo');
global[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));
global[MAXMIND] = await maxmind.open(process.env.GEOLITE_DB_PATH || path.resolve(dir, 'GeoLite2-City.mmdb'));
}
const result = global[MAXMIND].get(ip);