Add SEFINEK_API_URL
This commit is contained in:
parent
f5b14ab11d
commit
d329d3a83d
2 changed files with 6 additions and 3 deletions
|
|
@ -37,4 +37,7 @@ IP_REFRESH_INTERVAL=80
|
||||||
REPORT_TO_SEFINEK_API=false
|
REPORT_TO_SEFINEK_API=false
|
||||||
|
|
||||||
# How often should the log (reported_ips.csv) be analyzed and sent to the Sefinek API? In hours.
|
# How often should the log (reported_ips.csv) be analyzed and sent to the Sefinek API? In hours.
|
||||||
SEFINEK_API_INTERVAL=1
|
SEFINEK_API_INTERVAL=1
|
||||||
|
|
||||||
|
# Sefinek API v2 URL
|
||||||
|
SEFINEK_API_URL=https://api.sefinek.net/api/v2
|
||||||
|
|
@ -3,7 +3,7 @@ const { readReportedIPs, updateSefinekAPIInCSV } = require('./csv.js');
|
||||||
const log = require('./log.js');
|
const log = require('./log.js');
|
||||||
const clientIp = require('./clientIp.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 () => {
|
module.exports = async () => {
|
||||||
const userIp = clientIp.getAddress();
|
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');
|
if (!uniqueLogs?.length) return log('log', 'No unique IPs to send to Sefinek API');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(SEFINEK_API_URL, {
|
const res = await axios.post(API_URL, {
|
||||||
reportedIPs: uniqueLogs.map(ip => ({
|
reportedIPs: uniqueLogs.map(ip => ({
|
||||||
rayId: ip.rayId,
|
rayId: ip.rayId,
|
||||||
ip: ip.ip,
|
ip: ip.ip,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue