Add webhook bearer token support
Docker / build (push) Canceled after 0s

This commit is contained in:
2026-09-02 15:17:05 +02:00
parent c1961093d6
commit 93f7d78c27
5 changed files with 14 additions and 2 deletions
+2
View File
@@ -5,5 +5,7 @@ AWS_SECRET_ACCESS_KEY=your-aws-secret-key
PORT=25 PORT=25
S3_BUCKET_NAME=your-s3-bucket-name S3_BUCKET_NAME=your-s3-bucket-name
WEBHOOK_URL=https://your-webhook-url.com WEBHOOK_URL=https://your-webhook-url.com
# Optional: adds an Authorization: Bearer header to webhook requests
# WEBHOOK_BEARER_TOKEN=your-bearer-token
SMTP_SECURE=false SMTP_SECURE=false
WEBHOOK_CONCURRENCY=5 WEBHOOK_CONCURRENCY=5
+1
View File
@@ -63,6 +63,7 @@ einem kontrollierten Fehler, damit Supervisor den Fehler erkennen kann.
| Variable | Bedeutung | Standardwert | | Variable | Bedeutung | Standardwert |
| --- | --- | --- | | --- | --- | --- |
| `WEBHOOK_URL` | Ziel-URL für HTTP POST | erforderlich | | `WEBHOOK_URL` | Ziel-URL für HTTP POST | erforderlich |
| `WEBHOOK_BEARER_TOKEN` | Optionaler Bearer Token für den `Authorization`-Header des Webhooks | nicht gesetzt |
| `PORT` | SMTP-Port | `25` (Produktion: `2525`) | | `PORT` | SMTP-Port | `25` (Produktion: `2525`) |
| `SMTP_SECURE` | SMTPS/TLS beim Verbindungsaufbau aktivieren | `false` | | `SMTP_SECURE` | SMTPS/TLS beim Verbindungsaufbau aktivieren | `false` |
| `TLS_KEY_PATH` | TLS-Privatschlüssel, wenn `SMTP_SECURE=true` | keiner | | `TLS_KEY_PATH` | TLS-Privatschlüssel, wenn `SMTP_SECURE=true` | keiner |
+1
View File
@@ -11,6 +11,7 @@ function integerFromEnv(name, fallback) {
module.exports = { module.exports = {
WEBHOOK_URL: process.env.WEBHOOK_URL, WEBHOOK_URL: process.env.WEBHOOK_URL,
WEBHOOK_BEARER_TOKEN: process.env.WEBHOOK_BEARER_TOKEN || undefined,
PORT: integerFromEnv('PORT', 25), PORT: integerFromEnv('PORT', 25),
MAX_FILE_SIZE: integerFromEnv('MAX_FILE_SIZE', 5 * 1024 * 1024), MAX_FILE_SIZE: integerFromEnv('MAX_FILE_SIZE', 5 * 1024 * 1024),
MAX_MESSAGE_SIZE: integerFromEnv('MAX_MESSAGE_SIZE', 25 * 1024 * 1024), MAX_MESSAGE_SIZE: integerFromEnv('MAX_MESSAGE_SIZE', 25 * 1024 * 1024),
+1
View File
@@ -78,6 +78,7 @@ zwingend erforderlich und hat keinen öffentlichen Defaultwert.
| Variable | Bedeutung | Standardwert | | Variable | Bedeutung | Standardwert |
| --- | --- | --- | | --- | --- | --- |
| `WEBHOOK_URL` | Ziel-URL für die geparste Nachricht | erforderlich | | `WEBHOOK_URL` | Ziel-URL für die geparste Nachricht | erforderlich |
| `WEBHOOK_BEARER_TOKEN` | Optionaler Bearer Token für den `Authorization`-Header des Webhooks | nicht gesetzt |
| `PORT` | SMTP-Port | `25` (Produktion: `2525`) | | `PORT` | SMTP-Port | `25` (Produktion: `2525`) |
| `SMTP_SECURE` | TLS/SMTPS beim Verbindungsaufbau | `false` | | `SMTP_SECURE` | TLS/SMTPS beim Verbindungsaufbau | `false` |
| `TLS_KEY_PATH` | TLS-Privatschlüssel bei aktiviertem TLS | keiner | | `TLS_KEY_PATH` | TLS-Privatschlüssel bei aktiviertem TLS | keiner |
+8 -1
View File
@@ -2,7 +2,14 @@ const axios = require('axios');
const config = require('../config'); const config = require('../config');
function sendToWebhook(data) { function sendToWebhook(data) {
return axios.post(config.WEBHOOK_URL, data, { timeout: 5000 }); const headers = config.WEBHOOK_BEARER_TOKEN
? { Authorization: `Bearer ${config.WEBHOOK_BEARER_TOKEN}` }
: undefined;
return axios.post(config.WEBHOOK_URL, data, {
timeout: 5000,
headers
});
} }
module.exports = { sendToWebhook }; module.exports = { sendToWebhook };