-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
60 lines (53 loc) · 1.72 KB
/
ormconfig.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require('dotenv').config();
console.log('process.env.DATABASE_URL :>>', process.env.DATABASE_URL)
if (process.env.DEV_ENVIRONMENT === 'true'){
module.exports = {
type: "postgres",
host: process.env.DB_HOST,
port: process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
ssl: true,
extra: {
ssl: {
"rejectUnauthorized": false
}
},
synchronize: true,
logging: false,
entities: ['src/modules/**/infra/typeorm/entities/*.ts'],
migrations: ['src/shared/infra/database/typeorm/migrations/**/*.ts'],
subscribers: ['src/shared/infra/database/typeorm/subscribers/**/*.ts'],
cli: {
entitiesDir: './src/modules/**/infra/typeorm/entities/*.ts',
migrationsDir: 'src/shared/infra/database/typeorm/migrations',
subscribersDir: 'src/shared/infra/database/typeorm/subscribers',
},
};
} else {
module.exports = {
type: "postgres",
host: process.env.DB_HOST,
port: process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
ssl: true,
extra: {
ssl: {
"rejectUnauthorized": false
}
},
synchronize: true,
logging: false,
entities: ['dist/modules/**/infra/typeorm/entities/*.js'],
migrations: ['dist/shared/infra/database/typeorm/migrations/**/*.js'],
subscribers: ['dist/shared/infra/database/typeorm/subscribers/**/*.js'],
cli: {
entitiesDir: './dist/modules/**/infra/typeorm/entities/*.js',
migrationsDir: 'dist/shared/infra/database/typeorm/migrations',
subscribersDir: 'dist/shared/infra/database/typeorm/subscribers',
},
};
}