import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { TypeOrmModule } from '@nestjs/typeorm'; import { appConfig, databaseConfig, jwtConfig } from './config'; import { AuthModule } from './modules/auth/auth.module'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true, load: [appConfig, databaseConfig, jwtConfig], }), TypeOrmModule.forRootAsync({ useFactory: (configService) => ({ type: 'postgres', host: configService.get('database.host'), port: configService.get('database.port'), username: configService.get('database.username'), password: configService.get('database.password'), database: configService.get('database.database'), entities: [__dirname + '/**/*.entity{.ts,.js}'], synchronize: configService.get('database.synchronize'), logging: configService.get('database.logging'), }), inject: [ConfigModule], }), AuthModule, ], controllers: [], providers: [], }) export class AppModule {}