From bd37554b7d576979361301a713ed71c449674ca0 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 18 Dec 2025 20:59:31 -0400 Subject: [PATCH] maxmind fix --- maxmind.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/maxmind.js b/maxmind.js index 3905ace..faf378f 100644 --- a/maxmind.js +++ b/maxmind.js @@ -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,16 +158,20 @@ const outputDirectory = './maxmind'; const username = process.env.MAXMIND_ACCOUNT_NUMBER; const password = process.env.MAXMIND_LICENSE_KEY; -await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); +if( ENABLE_MAXMIND ) { + + await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); -setInterval(async () => { - try { - await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); - } catch (error) { - console.error('Error during MaxMind database update:', error); - } -}, 24 * 60 * 60 * 1000 + 1000); // 1 day + 1 second + setInterval(async () => { + try { + await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); + } catch (error) { + console.error('Error during MaxMind database update:', error); + } + }, 24 * 60 * 60 * 1000 + 1000); // 1 day + 1 second + +} export function countryForIP(ipAddress) {