maxmind fix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user