-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig.js
48 lines (46 loc) · 1.14 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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs')
const useCert = fs.existsSync(`${process.cwd()}/secrets/cert`)
// eslint-disable-next-line @typescript-eslint/ban-types
const ssl = {
ssl: true,
extra: {
ssl: {
require: true,
rejectUnauthorized: false,
...(useCert
? {
ca: fs.readFileSync(`${process.cwd()}/secrets/cert`).toString(),
}
: {}),
},
},
}
module.exports = {
type: 'postgres',
host: process.env.PGHOST,
port: process.env.PGPORT,
username: process.env.PGUSERNAME,
password: process.env.PGPASSWORD,
database: process.env.PGDATABASE,
synchronize: false,
...(process.env.ENV !== 'local'
? { entities: ['modules/**/*.entity.{ts,js}'] }
: { entities: ['dist/modules/**/*.entity.{ts,js}'] }),
...(process.env.ENV !== 'local'
? {
migrations: ['migrations/*.{ts,js}'],
}
: {
migrations: ['dist/migrations/*.{ts,js}'],
}),
cli: {
...(process.env.ENV !== 'local'
? {
migrationsDir: 'migrations',
}
: {
migrationsDir: 'src/migrations',
}),
},
}