63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
/**
|
|
* Infrastructure Module
|
|
*
|
|
* mpc-service 作为网关,需要:
|
|
* - PrismaService 用于缓存公钥和 delegate share
|
|
* - Kafka 事件发布和消费
|
|
* - BackupClientService 用于存储 delegate share 到 backup-service
|
|
* - BlockchainClientService 用于派生钱包地址
|
|
*/
|
|
|
|
import { Global, Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { HttpModule } from '@nestjs/axios';
|
|
|
|
// Persistence
|
|
import { PrismaService } from './persistence/prisma/prisma.service';
|
|
|
|
// Kafka Messaging
|
|
import { EventPublisherService } from './messaging/kafka/event-publisher.service';
|
|
import { EventConsumerService } from './messaging/kafka/event-consumer.service';
|
|
|
|
// External Services
|
|
import { BackupClientService } from './external/backup';
|
|
import { BlockchainClientService } from './external/blockchain';
|
|
|
|
// Redis
|
|
import { DistributedLockService } from './redis/lock/distributed-lock.service';
|
|
|
|
@Global()
|
|
@Module({
|
|
imports: [
|
|
ConfigModule,
|
|
HttpModule.register({
|
|
timeout: 30000,
|
|
maxRedirects: 5,
|
|
}),
|
|
],
|
|
providers: [
|
|
// Prisma (用于缓存公钥和 delegate share)
|
|
PrismaService,
|
|
|
|
// Kafka (事件发布和消费)
|
|
EventPublisherService,
|
|
EventConsumerService,
|
|
|
|
// External Services
|
|
BackupClientService,
|
|
BlockchainClientService,
|
|
|
|
// Redis (分布式锁)
|
|
DistributedLockService,
|
|
],
|
|
exports: [
|
|
PrismaService,
|
|
EventPublisherService,
|
|
EventConsumerService,
|
|
BackupClientService,
|
|
BlockchainClientService,
|
|
DistributedLockService,
|
|
],
|
|
})
|
|
export class InfrastructureModule {}
|