Merge pull request #3465 from undefined-moe/patch-1

allow custom geolite database path
This commit is contained in:
Mike Cao 2025-06-08 22:06:01 -07:00 committed by GitHub
commit bfb7b611e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

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);