import { TypeOrmModuleOptions } from '@nestjs/typeorm'; import { ConfigService } from '@nestjs/config'; export const getDatabaseConfig = ( configService: ConfigService, ): TypeOrmModuleOptions => ({ type: 'postgres', host: configService.get('DB_HOST', 'localhost'), port: configService.get('DB_PORT', 5432), username: configService.get('DB_USER'), password: configService.get('DB_PASSWORD'), database: configService.get('DB_DATABASE'), synchronize: configService.get('NODE_ENV') !== 'production', autoLoadEntities: true, logging: configService.get('NODE_ENV') === 'development', });