You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
980 B
33 lines
980 B
import { Module } from '@nestjs/common';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
import { ConfigModule } from './config/config.module';
|
|
import { ConfigService } from './config/config.service';
|
|
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule,
|
|
TypeOrmModule.forRootAsync({
|
|
imports: [ConfigModule],
|
|
useFactory: async (
|
|
configService: ConfigService,
|
|
): Promise<TypeOrmModuleOptions> => ({
|
|
type: 'postgres',
|
|
url: configService.databaseUrl,
|
|
entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
|
synchronize: true,
|
|
logging: configService.isLoggingDb ? 'all' : false,
|
|
extra: {
|
|
ssl: {
|
|
rejectUnauthorized: false
|
|
},
|
|
},
|
|
}),
|
|
inject: [ConfigService],
|
|
}),
|
|
],
|
|
controllers: [AppController],
|
|
providers: [AppService],
|
|
})
|
|
export class AppModule {}
|