Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/api/integrations/event/sqs/sqs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class SqsController extends EventController implements EventControllerInt
accessKeyId: awsConfig.ACCESS_KEY_ID,
secretAccessKey: awsConfig.SECRET_ACCESS_KEY,
},

region: awsConfig.REGION,
endpoint: awsConfig.ENDPOINT,
});

this.logger.info('SQS initialized');
Expand Down Expand Up @@ -304,4 +304,15 @@ export class SqsController extends EventController implements EventControllerInt
this.logger.error(`Error listing queues for ${prefixName}: ${err.message}`);
}
}

private getQueueUrl(sqsConfig: Sqs, queueName: string): string {
if (sqsConfig.ENDPOINT) {
const endpoint = sqsConfig.ENDPOINT.replace(/\/+$/, '');
if (endpoint.endsWith(sqsConfig.ACCOUNT_ID)) {
return `${endpoint}/${queueName}`;
}
return `${endpoint}/${sqsConfig.ACCOUNT_ID}/${queueName}`;
}
Comment on lines +309 to +315
return `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;
}
}
2 changes: 2 additions & 0 deletions src/config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type Sqs = {
SECRET_ACCESS_KEY: string;
ACCOUNT_ID: string;
REGION: string;
ENDPOINT?: string;
BASE_URL: string;
MAX_PAYLOAD_SIZE: number;
EVENTS: {
Expand Down Expand Up @@ -594,6 +595,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 || '',
ENDPOINT: process.env.SQS_ENDPOINT || undefined,
BASE_URL: process.env.SQS_BASE_URL || '',
MAX_PAYLOAD_SIZE: Number.parseInt(process.env.SQS_MAX_PAYLOAD_SIZE ?? '1048576'),
Comment on lines 596 to 600
EVENTS: {
Expand Down
Loading