fix(syncing-server): binding

This commit is contained in:
Karol Sójko 2023-10-17 10:41:55 +02:00
parent aba4f90485
commit 5b06ea94f9
No known key found for this signature in database
GPG key ID: C2F813669419D05F

View file

@ -289,11 +289,8 @@ export class ContainerConfigLoader {
)
})
container.bind<SQSClient>(TYPES.Sync_SQS).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Sync_Env)
const sqsConfig: SQSClientConfig = {
region: env.get('SQS_AWS_REGION'),
region: env.get('SQS_AWS_REGION', true),
}
if (env.get('SQS_ENDPOINT', true)) {
sqsConfig.endpoint = env.get('SQS_ENDPOINT', true)
@ -304,9 +301,8 @@ export class ContainerConfigLoader {
secretAccessKey: env.get('SQS_SECRET_ACCESS_KEY', true),
}
}
return new SQSClient(sqsConfig)
})
const sqsClient = new SQSClient(sqsConfig)
container.bind<SQSClient>(TYPES.Sync_SQS).toConstantValue(sqsClient)
container.bind<S3Client | undefined>(TYPES.Sync_S3).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Sync_Env)
@ -1138,7 +1134,6 @@ export class ContainerConfigLoader {
container
.bind<DomainEventMessageHandlerInterface>(TYPES.Sync_DomainEventMessageHandler)
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger)))
}
container
.bind<DomainEventSubscriberInterface>(TYPES.Sync_DomainEventSubscriber)
@ -1151,6 +1146,7 @@ export class ContainerConfigLoader {
container.get<Logger>(TYPES.Sync_Logger),
),
)
}
container
.bind<ControllerContainerInterface>(TYPES.Sync_ControllerContainer)