mam-kupi-api/typeorm.config.ts

19 lines
510 B
TypeScript
Raw Normal View History

2023-09-06 05:22:05 +00:00
import { DataSource } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { config } from 'dotenv';
config();
const configService = new ConfigService();
export default new DataSource({
type: 'postgres',
host: configService.get('DB_HOST'),
port: +configService.get('DB_PORT'),
username: configService.get('DB_USER'),
password: configService.get('DB_PASSWORD'),
database: configService.get('DB_NAME'),
entities: ['dist/**/*.entity.js'],
migrations: ['migrations/**/*'],
});