-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
45 lines (44 loc) · 1.44 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
const ssl = process.env.NODE_ENV.trimEnd() === 'production' ? {"rejectUnauthorized": false} : false
const entities = process.env.NODE_ENV.trimEnd() === 'production' ? "./dist/**/entities/*.js" : "./src/**/entities/*.ts"
const migrations = process.env.NODE_ENV.trimEnd() === 'production' ? "./dist/shared/typeorm/migrations/*.js" :"./src/shared/typeorm/migrations/*.ts"
const migrationsDir = process.env.NODE_ENV.trimEnd() === 'production' ? "./dist/shared/typeorm/migrations" : "./src/shared/typeorm/migrations"
module.exports = [
{
"name": "test",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "root",
"password": "root",
"database": "stone-marvel-test",
"entities": [
"./src/**/entities/*.ts"
],
"migrations": [
"./src/shared/typeorm/migrations/*.ts"
],
"cli": {
"migrationsDir": "./src/shared/typeorm/migrations"
}
},
{
"name": "default",
"type": process.env.DATABASE_TYPE || "postgres",
"url": process.env.DATABASE_URL,
"host": process.env.DATABASE_HOST || "localhost",
"port": process.env.DATABASE_PORT || 5432,
"username": process.env.DATABASE_USERNAME || "root",
"password": process.env.DATABASE_PASS || "root",
"database": process.env.DATABASE_DATABASE || "stone-marvel",
"ssl": ssl,
"entities": [
entities
],
"migrations": [
migrations
],
"cli": {
"migrationsDir": migrationsDir
}
}
]