-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig.js
44 lines (39 loc) · 875 Bytes
/
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
var dbConfig = {
synchronize: false,
migrations: ['migrations/*.js'],
migrationsTableName: "migrations",
// cli: {
// migrationsDir: 'migrations',
// },
}
switch (process.env.NODE_ENV) {
case 'development':
Object.assign(dbConfig, {
type: 'sqlite',
database: 'db.sqlite',
entitties: ['**/*.entity.js']
})
break;
case 'test':
Object.assign(dbConfig, {
type: 'sqlite',
database: 'test.sqlite',
entitties: ['**/*.entity.ts'],
migrationsRun: true,
})
break;
case 'production':
Object.assign(dbConfig, {
type: 'postgres',
url: process.env.DATABASE_URL,
entitties: ['**/*.entity.js'],
migrationsRun: true,
ssl: {
rejectUnauthorized: false,
}
})
break;
default:
throw new Error('Unknown Environment')
}
module.exports = dbConfig;