This commit is contained in:
alma 2025-05-22 18:34:41 +02:00
parent f2192b7856
commit bc5f30fd06

View File

@ -3,11 +3,13 @@ import { env } from '@/lib/env';
export class N8nService {
private webhookUrl: string;
private rollbackWebhookUrl: string;
private apiKey: string;
constructor() {
// Use consistent webhook URLs without -test suffix
this.webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook-test/mission-created';
this.rollbackWebhookUrl = process.env.N8N_ROLLBACK_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook-test/mission-rollback';
this.webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook/mission-created';
this.rollbackWebhookUrl = process.env.N8N_ROLLBACK_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook/mission-rollback';
this.apiKey = process.env.N8N_API_KEY || '';
}
async triggerMissionCreation(data: any): Promise<any> {
@ -21,6 +23,7 @@ export class N8nService {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': this.apiKey
},
body: data
};
@ -30,6 +33,7 @@ export class N8nService {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': this.apiKey
},
body: JSON.stringify(data),
});
@ -84,6 +88,7 @@ export class N8nService {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': this.apiKey
},
body: JSON.stringify(data),
});