-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.source.ts
More file actions
22 lines (19 loc) · 774 Bytes
/
Copy pathdata.source.ts
File metadata and controls
22 lines (19 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { DataSource, DataSourceOptions } from 'typeorm';
import * as dotenv from 'dotenv';
dotenv.config();
const dbConfig: TypeOrmModuleOptions & DataSourceOptions = {
type: 'postgres',
host: process.env.DB_HOST,
// @ts-expect-error ignore
port: +process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
autoLoadEntities: true,
synchronize: false, // Setting synchronize: true shouldn't be used in production - otherwise you can lose production data.
entities: ['dist/**/*.entity{.ts,.js}'],
migrations: ['dist/src/migrations/*{.ts,.js}'],
};
const AppDataSource = new DataSource(dbConfig);
export { dbConfig, AppDataSource };