import { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; import { GraphQLModule } from '@nestjs/graphql'; import { TypeOrmModule } from '@nestjs/typeorm'; import { AppController } from './app.controller'; import { AppResolver } from './app.resolver'; import { AppService } from './app.service'; import { ProjectsModule } from './projects/projects.module'; import { ReposModule } from './repos/repos.module'; import { PipelinesModule } from './pipelines/pipelines.module'; import configuration from './commons/config/configuration'; @Module({ imports: [ ConfigModule.forRoot({ load: [configuration], }), TypeOrmModule.forRootAsync({ imports: [ConfigModule], useFactory: (configService: ConfigService) => ({ type: 'postgres', host: configService.get('db.postgres.host'), port: configService.get('db.postgres.port'), username: configService.get('db.postgres.username'), password: configService.get('db.postgres.password'), database: configService.get('db.postgres.database'), synchronize: true, autoLoadEntities: true, }), inject: [ConfigService], }), GraphQLModule.forRootAsync({ imports: [ConfigModule], useFactory: (configService: ConfigService) => ({ debug: configService.get('env') !== 'prod', playground: true, autoSchemaFile: true, }), inject: [ConfigService], }), ProjectsModule, ReposModule, PipelinesModule, ], controllers: [AppController], providers: [AppService, AppResolver], }) export class AppModule {}