-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-source.ts
More file actions
29 lines (26 loc) · 950 Bytes
/
data-source.ts
File metadata and controls
29 lines (26 loc) · 950 Bytes
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
// data-source.ts
import * as dotenv from 'dotenv';
import { DataSource } from 'typeorm';
import appConfig from './src/config/configuration';
import { Actions } from './src/entities/Actions.entity';
import { Channel } from './src/entities/Channels.entity';
import { Modules } from './src/entities/Modules.entity';
import { Permissions } from './src/entities/Permissions.entity';
import { Role } from './src/entities/Role.entity';
import { User } from './src/entities/User.entity';
dotenv.config();
const config = appConfig();
export const AppDataSource = new DataSource({
type: 'postgres',
host: config.database.host,
port: config.database.port,
username: config.database.username,
password: config.database.password,
database: config.database.name,
entities: [Channel, User, Role, Permissions, Modules, Actions],
migrations: ['src/database/migrations/*.ts'],
ssl: {
rejectUnauthorized: false,
},
synchronize: false,
});