Add SEFINEK_API_URL

This commit is contained in:
Sefinek 2024-09-18 12:38:39 +02:00
parent f5b14ab11d
commit d329d3a83d
2 changed files with 6 additions and 3 deletions

View file

@ -38,3 +38,6 @@ REPORT_TO_SEFINEK_API=false
# How often should the log (reported_ips.csv) be analyzed and sent to the Sefinek API? In hours.
SEFINEK_API_INTERVAL=1
# Sefinek API v2 URL
SEFINEK_API_URL=https://api.sefinek.net/api/v2

View file

@ -3,7 +3,7 @@ const { readReportedIPs, updateSefinekAPIInCSV } = require('./csv.js');
const log = require('./log.js');
const clientIp = require('./clientIp.js');
const SEFINEK_API_URL = process.env.SEFINEK_API_URL || `${process.env.NODE_ENV === 'production' ? 'https://api.sefinek.net' : 'http://127.0.0.1:4010'}/api/v2/cloudflare-waf-abuseipdb/post`;
const API_URL = `${process.env.SEFINEK_API_URL}/api/v2/cloudflare-waf-abuseipdb/post`;
module.exports = async () => {
const userIp = clientIp.getAddress();
@ -20,7 +20,7 @@ module.exports = async () => {
if (!uniqueLogs?.length) return log('log', 'No unique IPs to send to Sefinek API');
try {
const res = await axios.post(SEFINEK_API_URL, {
const res = await axios.post(API_URL, {
reportedIPs: uniqueLogs.map(ip => ({
rayId: ip.rayId,
ip: ip.ip,