diff --git a/maxmind.js b/maxmind.js index 6c5ca9a..3905ace 100644 --- a/maxmind.js +++ b/maxmind.js @@ -112,6 +112,11 @@ async function downloadAndExtractMaxmindData(url, outputDir, tempDir, username, * @return {Promise} Resolves when the data check and optional update process is completed. */ async function checkAndUpdateMaxmindData(outputDir, tempDir, url, username, password) { + if (username === '' || password === '') { + console.log('No MaxMind credentials provided. Skipping MaxMind database update.'); + return + } + console.log('Checking for MaxMind database updates.'); // Ensure the output directory exists @@ -146,10 +151,10 @@ async function checkAndUpdateMaxmindData(outputDir, tempDir, url, username, pass const url = 'https://download.maxmind.com/geoip/databases/GeoIP2-Country/download?suffix=tar.gz'; const outputDirectory = './maxmind'; -const username = '1102431'; -const password = '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'; -// const username = process.env.MAXMIND_ACCOUNT_NUMBER; -// const password = process.env.MAXMIND_LICENSE_KEY; +// const username = '1102431'; +// const password = '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'; +const username = process.env.MAXMIND_ACCOUNT_NUMBER; +const password = process.env.MAXMIND_LICENSE_KEY; await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password);