diff --git a/env.example b/env.example index 5fe448b82..d6509d546 100644 --- a/env.example +++ b/env.example @@ -166,6 +166,7 @@ SQS_ACCESS_KEY_ID= SQS_SECRET_ACCESS_KEY= SQS_ACCOUNT_ID= SQS_REGION= +SQS_BASE_URL= SQS_MAX_PAYLOAD_SIZE=1048576 # =========================================== diff --git a/src/api/integrations/event/sqs/sqs.controller.ts b/src/api/integrations/event/sqs/sqs.controller.ts index 2b0398ef2..d18677c4f 100644 --- a/src/api/integrations/event/sqs/sqs.controller.ts +++ b/src/api/integrations/event/sqs/sqs.controller.ts @@ -126,7 +126,9 @@ export class SqsController extends EventController implements EventControllerInt ? 'singlequeue' : `${event.replace('.', '_').toLowerCase()}`; const queueName = `${prefixName}_${eventFormatted}.fifo`; - const sqsUrl = `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`; + const rawBaseUrl = sqsConfig.BASE_URL || `https://sqs.${sqsConfig.REGION}.amazonaws.com`; + const baseUrl = rawBaseUrl.replace(/\/+$/, ''); + const sqsUrl = `${baseUrl}/${sqsConfig.ACCOUNT_ID}/${queueName}`; const message = { ...(extra ?? {}), diff --git a/src/config/env.config.ts b/src/config/env.config.ts index 7c4e382e7..f1265a875 100644 --- a/src/config/env.config.ts +++ b/src/config/env.config.ts @@ -121,6 +121,7 @@ export type Sqs = { SECRET_ACCESS_KEY: string; ACCOUNT_ID: string; REGION: string; + BASE_URL: string; MAX_PAYLOAD_SIZE: number; EVENTS: { APPLICATION_STARTUP: boolean; @@ -585,6 +586,7 @@ export class ConfigService { SECRET_ACCESS_KEY: process.env.SQS_SECRET_ACCESS_KEY || '', ACCOUNT_ID: process.env.SQS_ACCOUNT_ID || '', REGION: process.env.SQS_REGION || '', + BASE_URL: process.env.SQS_BASE_URL || '', MAX_PAYLOAD_SIZE: Number.parseInt(process.env.SQS_MAX_PAYLOAD_SIZE ?? '1048576'), EVENTS: { APPLICATION_STARTUP: process.env?.SQS_GLOBAL_APPLICATION_STARTUP === 'true',