45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import Redis from 'ioredis';
|
|
|
|
import { getConfig } from '@hexahost/config';
|
|
|
|
import { BillingModule } from '../../billing/billing.module';
|
|
import { AuthModule } from '../../auth/auth.module';
|
|
import { ServersModule } from '../../servers/servers.module';
|
|
|
|
import { WhmcsIntegrationController } from './whmcs-integration.controller';
|
|
import { WhmcsEventsService } from './whmcs-events.service';
|
|
import { INTEGRATIONS_REDIS } from './whmcs-integration.constants';
|
|
import { WhmcsIntegrationGuard } from './whmcs-integration.guard';
|
|
import { WhmcsIntegrationService } from './whmcs-integration.service';
|
|
import { WhmcsReconciliationService } from './whmcs-reconciliation.service';
|
|
import { WhmcsUsageService } from './whmcs-usage.service';
|
|
|
|
export { INTEGRATIONS_REDIS } from './whmcs-integration.constants';
|
|
|
|
@Module({
|
|
imports: [ServersModule, BillingModule, AuthModule],
|
|
controllers: [WhmcsIntegrationController],
|
|
providers: [
|
|
WhmcsIntegrationService,
|
|
WhmcsReconciliationService,
|
|
WhmcsEventsService,
|
|
WhmcsUsageService,
|
|
WhmcsIntegrationGuard,
|
|
{
|
|
provide: INTEGRATIONS_REDIS,
|
|
useFactory: () => {
|
|
const config = getConfig();
|
|
return new Redis(config.REDIS_URL, {
|
|
maxRetriesPerRequest: null,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
provide: Redis,
|
|
useExisting: INTEGRATIONS_REDIS,
|
|
},
|
|
],
|
|
})
|
|
export class WhmcsIntegrationModule {}
|