-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
57 lines (55 loc) · 1.09 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
const dotenv = require('dotenv')
let parsedConfig = {
...process.env
}
switch (process.env.NODE_ENV) {
case 'production':
parsedConfig = {
...parsedConfig,
...dotenv
.config({
path: 'production.env'
}).parsed
}
break
case 'test':
parsedConfig = {
...parsedConfig,
...dotenv
.config({
path: 'test.env'
}).parsed
}
break
default:
parsedConfig = {
...parsedConfig,
...dotenv.config().parsed
}
}
module.exports = {
name: 'default',
type: parsedConfig.DB_TYPE,
host: parsedConfig.DB_HOST,
port: parsedConfig.DB_PORT,
username: parsedConfig.DB_USERNAME,
password: parsedConfig.DB_PASSWORD,
database: parsedConfig.DB_NAME,
synchronize: false,
logging: false,
entities: [
'src/entities/**/*.ts'
],
migrations: [
'src/migrations/**/*.ts'
],
migrationsTableName: 'migration_logs',
subscribers: [
'src/subscribers/**/*.ts'
],
cli: {
entitiesDir: 'src/entities',
migrationsDir: 'src/migrations',
subscribersDir: 'src/subscribers'
}
}