34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { PaymentModule } from './payment/payment.module';
|
|
import { OrderModule } from './order/order.module';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
envFilePath: ['.env.local', '.env'],
|
|
}),
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
imports: [ConfigModule],
|
|
inject: [ConfigService],
|
|
useFactory: (configService: ConfigService) => ({
|
|
type: 'postgres',
|
|
host: configService.get('POSTGRES_HOST', 'localhost'),
|
|
port: configService.get<number>('POSTGRES_PORT', 5432),
|
|
username: configService.get('POSTGRES_USER', 'iconsulting'),
|
|
password: configService.get('POSTGRES_PASSWORD'),
|
|
database: configService.get('POSTGRES_DB', 'iconsulting'),
|
|
entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
|
synchronize: configService.get('NODE_ENV') === 'development',
|
|
}),
|
|
}),
|
|
|
|
OrderModule,
|
|
PaymentModule,
|
|
],
|
|
})
|
|
export class AppModule {}
|