-
Notifications
You must be signed in to change notification settings - Fork 0
/
typeOrm.config.ts
33 lines (29 loc) · 1.01 KB
/
typeOrm.config.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
26
27
28
29
30
31
32
33
import { DataSource } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { config } from 'dotenv';
import { entities as AccountEntities } from './src/account/account.module';
import { entities as EpochEntities } from './src/epoch/epoch.module';
import { entities as PoolEntities } from './src/pool/pool.module';
import { entities as SpotEntities } from './src/spot/spot.module';
import { entities as UserEntities } from './src/user/user.module';
import { entities as BillingEntities } from './src/billing/billing.module';
config();
const configService = new ConfigService();
const entities = [
...AccountEntities,
...EpochEntities,
...PoolEntities,
...SpotEntities,
...UserEntities,
...BillingEntities,
];
export default new DataSource({
type: 'postgres',
host: configService.get('DB_HOST'),
port: configService.get('DB_PORT'),
username: configService.get('DB_USERNAME'),
password: configService.get('DB_PASSWORD'),
database: configService.get('DB_NAME'),
entities,
migrations: [],
});