Add RUN_ON_START

This commit is contained in:
Sefinek 2025-03-10 23:32:47 +01:00
parent 8f6dfc03d9
commit 120c0e3b68
2 changed files with 6 additions and 3 deletions

View file

@ -1,9 +1,10 @@
exports.CONFIG = { exports.CONFIG = {
MAIN: { MAIN: {
NODE_ENV: 'production', // Environment mode: 'production' or 'development' NODE_ENV: 'production', // Environment mode: 'production' or 'development'
CLOUDFLARE_ZONE_ID: '00000000000000000000000000000000', // https://dash.cloudflare.com/profile/api-tokens CLOUDFLARE_ZONE_ID: '00000000000000000000000000000000', // API key for Cloudflare access
CLOUDFLARE_API_KEY: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', // API key for Cloudflare access CLOUDFLARE_API_KEY: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', // https://dash.cloudflare.com/profile/api-tokens
ABUSEIPDB_API_KEY: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', // API key for reporting malicious IPs to AbuseIPDB ABUSEIPDB_API_KEY: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', // API key for reporting malicious IPs to AbuseIPDB
RUN_ON_START: true, // Should the reporting function run immediately after the script starts?
}, },
CYCLES: { CYCLES: {

View file

@ -168,7 +168,9 @@ const cron = async () => {
// Ready // Ready
process.send && process.send('ready'); process.send && process.send('ready');
log(0, 'The integration is ready!');
// AbuseIPDB // AbuseIPDB
new CronJob(CONFIG.CYCLES.REPORT_SCHEDULE, cron, null, true, 'UTC'); new CronJob(CONFIG.CYCLES.REPORT_SCHEDULE, cron, null, true, 'UTC');
await cron(); if (CONFIG.MAIN.RUN_ON_START) await cron();
})(); })();