init
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService, registerAs } from '@nestjs/config';
|
||||
import { APP_GUARD } from '@nestjs/core';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import {
|
||||
getAppConfig,
|
||||
getCoingeckoConfig,
|
||||
getEncryptionConfig,
|
||||
getJwtConfig,
|
||||
getKrakenConfig,
|
||||
getOrderConfig,
|
||||
getInvoiceConfig,
|
||||
getMoneroWalletConfig,
|
||||
getPostgresConfig,
|
||||
getShopSettingsConfig,
|
||||
getSimplexConfig
|
||||
} from './config';
|
||||
import { validate } from './config/validate';
|
||||
import { AuthModule } from './modules/auth/AuthModule';
|
||||
import { EncryptionModule } from './modules/encryption/EncryptionModule';
|
||||
import { HealthCheckModule } from './modules/healthCheck/HealthCheckModule';
|
||||
import { MoneroWalletModule } from './modules/moneroWallet/MoneroWalletModule';
|
||||
import { SimplexModule } from './modules/simplex/SimplexModule';
|
||||
import { DiscountCodesModule } from './modules/discountCode/DiscountCodesModule';
|
||||
import { DataWipeModule } from './modules/dataWipe/DataWipeModule';
|
||||
import { NotificationsModule } from './modules/notifications/NotificationsModule';
|
||||
import { OrderModule } from './modules/order/OrderModule';
|
||||
import { PaymentModule } from './modules/payment/PaymentModule';
|
||||
import { ProductsModule } from './modules/product/ProductsModule';
|
||||
import { ShopSettingsModule } from './modules/shopSettings/ShopSettingsModule';
|
||||
import { StorefrontCartModule } from './modules/storefrontCart/StorefrontCartModule';
|
||||
import { StorefrontCheckoutModule } from './modules/storefrontCheckout/StorefrontCheckoutModule';
|
||||
import { StorefrontOrderModule } from './modules/storefrontOrder/StorefrontOrderModule';
|
||||
import { StorefrontCoreModule } from './modules/storefrontCore/StorefrontCoreModule';
|
||||
import { StorefrontProductModule } from './modules/storefrontProduct/StorefrontProductModule';
|
||||
import { XmrRateModule } from './modules/xmrRate/XmrRateModule';
|
||||
import { Config } from './types/Config';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ScheduleModule.forRoot(),
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
validate,
|
||||
load: [
|
||||
registerAs('postgres', getPostgresConfig),
|
||||
registerAs('app', getAppConfig),
|
||||
registerAs('jwt', getJwtConfig),
|
||||
registerAs('coingecko', getCoingeckoConfig),
|
||||
registerAs('kraken', getKrakenConfig),
|
||||
registerAs('encryption', getEncryptionConfig),
|
||||
registerAs('shopSettings', getShopSettingsConfig),
|
||||
registerAs('order', getOrderConfig),
|
||||
registerAs('invoice', getInvoiceConfig),
|
||||
registerAs('moneroWallet', getMoneroWalletConfig),
|
||||
registerAs('simplex', getSimplexConfig)
|
||||
]
|
||||
}),
|
||||
ThrottlerModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (configService: ConfigService) => {
|
||||
const { throttle } = configService.get('app') as Config['app'];
|
||||
|
||||
return {
|
||||
throttlers: [
|
||||
{
|
||||
name: 'default',
|
||||
ttl: throttle.ttlMs,
|
||||
limit: throttle.limit
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}),
|
||||
XmrRateModule,
|
||||
TypeOrmModule.forRootAsync({
|
||||
useFactory: (configService: ConfigService) => configService.get('postgres') as Config['postgres'],
|
||||
inject: [ConfigService]
|
||||
}),
|
||||
HealthCheckModule,
|
||||
EncryptionModule,
|
||||
AuthModule,
|
||||
ProductsModule,
|
||||
ShopSettingsModule,
|
||||
SimplexModule,
|
||||
NotificationsModule,
|
||||
DiscountCodesModule,
|
||||
OrderModule,
|
||||
PaymentModule,
|
||||
DataWipeModule,
|
||||
MoneroWalletModule,
|
||||
StorefrontCoreModule,
|
||||
StorefrontProductModule,
|
||||
StorefrontCartModule,
|
||||
StorefrontCheckoutModule,
|
||||
StorefrontOrderModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: APP_GUARD,
|
||||
useClass: ThrottlerGuard
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
Reference in New Issue
Block a user