import { Injectable } from '@nestjs/common' ; import { TypeOrmModuleOptions , TypeOrmOptionsFactory } from '@nestjs/typeorm' ; @ Injectable ( ) export class TypeOrmConfigService implements TypeOrmOptionsFactory { createTypeOrmOptions ( ) { return { type : 'postgres' , host : process . env . POSTGRES_HOST , port : parseInt ( process . env . POSTGRES_PORT ) , username : process . env . POSTGRES_USERNAME , password : process . env . POSTGRES_PASSWORD , database : process . env . POSTGRES_DATABASE , synchronize : true , autoLoadEntities : true , } ; } }