add TypeORM postgres config and migration runner.
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfig from './config';
|
||||
import { ConfigModule, ConfigService, registerAs } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { getAppConfig, getPostgresConfig } from './config';
|
||||
import { HealthCheckModule } from './modules/healthCheck/HealthCheckModule';
|
||||
import { Config } from './types/Config';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
load: [appConfig]
|
||||
load: [registerAs('postgres', getPostgresConfig), registerAs('app', getAppConfig)]
|
||||
}),
|
||||
TypeOrmModule.forRootAsync({
|
||||
useFactory: (configService: ConfigService) => configService.get('postgres') as Config['postgres'],
|
||||
inject: [ConfigService]
|
||||
}),
|
||||
HealthCheckModule
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user