maxmind fix

This commit is contained in:
tim
2025-12-18 20:59:31 -04:00
parent 0a9b0cc631
commit bd37554b7d

View File

@@ -3,6 +3,8 @@ import path from 'path';
import {extract} from "tar";
import {Reader} from '@maxmind/geoip2-node';
const ENABLE_MAXMIND=false
let ipdb = null
function setDbFile(file) {
const dbBuffer = fs.readFileSync(file);
@@ -156,6 +158,8 @@ const outputDirectory = './maxmind';
const username = process.env.MAXMIND_ACCOUNT_NUMBER;
const password = process.env.MAXMIND_LICENSE_KEY;
if( ENABLE_MAXMIND ) {
await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password);
@@ -167,6 +171,8 @@ setInterval(async () => {
}
}, 24 * 60 * 60 * 1000 + 1000); // 1 day + 1 second
}
export function countryForIP(ipAddress) {
if (!ipdb) return null