forked from NarHakobyan/awesome-nest-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.ts
25 lines (21 loc) · 747 Bytes
/
ormconfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import './src/boilerplate.polyfill';
import dotenv from 'dotenv';
import { DataSource } from 'typeorm';
import { UserSubscriber } from './src/entity-subscribers/user-subscriber';
import { SnakeNamingStrategy } from './src/snake-naming.strategy';
dotenv.config();
export const dataSource = new DataSource({
type: 'postgres',
host: process.env.DB_HOST,
port: Number(process.env.DB_PORT),
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
namingStrategy: new SnakeNamingStrategy(),
subscribers: [UserSubscriber],
entities: [
'src/modules/**/*.entity{.ts,.js}',
'src/modules/**/*.view-entity{.ts,.js}',
],
migrations: ['src/database/migrations/*{.ts,.js}'],
});