Skip to content

Commit 3b2f4b7

Browse files
committed
refactor(webhook): make webhook base URL configurable
Replace hardcoded webhook base URL with configurable value from ConfigService. Changes: - Add ConfigService dependency to WebhookService - Update generateWebhookUrl() to read WEBHOOK_BASE_URL from config - Maintain backward compatibility with default value 'https://api.refly.ai' This allows users to configure custom webhook endpoints via environment variables, supporting self-hosted and enterprise deployments. Closes TODO: Get base URL from config
1 parent 5afcaac commit 3b2f4b7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/api/src/modules/webhook/webhook.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Injectable, Logger, NotFoundException, ForbiddenException } from '@nestjs/common';
2+
import { ConfigService } from '@nestjs/config';
23
import { PrismaService } from '../common/prisma.service';
34
import { RedisService } from '../common/redis.service';
45
import { WorkflowAppService } from '../workflow-app/workflow-app.service';
@@ -60,6 +61,7 @@ export class WebhookService {
6061
private readonly redis: RedisService,
6162
private readonly workflowAppService: WorkflowAppService,
6263
private readonly canvasService: CanvasService,
64+
private readonly config: ConfigService,
6365
) {}
6466

6567
/**
@@ -806,8 +808,8 @@ export class WebhookService {
806808
* Generate webhook URL
807809
*/
808810
private generateWebhookUrl(webhookId: string): string {
809-
// TODO: Get base URL from config
810-
return `https://api.refly.ai/v1/openapi/webhook/${webhookId}/run`;
811+
const baseUrl = this.config.get<string>('WEBHOOK_BASE_URL') || 'https://api.refly.ai';
812+
return `${baseUrl}/v1/openapi/webhook/${webhookId}/run`;
811813
}
812814
}
813815

0 commit comments

Comments
 (0)