W n8n attention warning
This commit is contained in:
parent
a2b3bcf72b
commit
854f3150cc
@ -5,15 +5,22 @@ export class N8nService {
|
||||
private readonly apiKey: string;
|
||||
|
||||
constructor() {
|
||||
this.n8nUrl = process.env.N8N_URL || '';
|
||||
this.n8nUrl = process.env.N8N_URL || 'https://brain.slm-lab.net';
|
||||
this.apiKey = process.env.N8N_API_KEY || '';
|
||||
|
||||
if (!this.n8nUrl || !this.apiKey) {
|
||||
throw new Error('N8N_URL and N8N_API_KEY must be set in environment variables');
|
||||
// Only log a warning if API key is missing
|
||||
if (!this.apiKey) {
|
||||
console.warn('N8N_API_KEY is not set in environment variables. n8n integration will be disabled.');
|
||||
}
|
||||
}
|
||||
|
||||
async triggerMissionCreation(data: any): Promise<{ success: boolean; error?: string }> {
|
||||
// If API key is not set, skip n8n integration
|
||||
if (!this.apiKey) {
|
||||
console.log('Skipping n8n integration - API key not set');
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${this.n8nUrl}/webhook/mission-creation`, {
|
||||
method: 'POST',
|
||||
@ -34,6 +41,7 @@ export class N8nService {
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error triggering n8n workflow:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Failed to trigger n8n workflow'
|
||||
@ -42,6 +50,12 @@ export class N8nService {
|
||||
}
|
||||
|
||||
async rollbackMissionCreation(data: any): Promise<{ success: boolean; error?: string }> {
|
||||
// If API key is not set, skip n8n integration
|
||||
if (!this.apiKey) {
|
||||
console.log('Skipping n8n rollback - API key not set');
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${this.n8nUrl}/webhook/mission-rollback`, {
|
||||
method: 'POST',
|
||||
@ -62,6 +76,7 @@ export class N8nService {
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error triggering n8n rollback workflow:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Failed to trigger n8n rollback workflow'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user