forked from amand33p/bug-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
37 lines (36 loc) · 1.11 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
const type = process.env.TYPEORM_TYPE || 'postgres';
const username = process.env.TYPEORM_USERNAME || 'postgres';
const password = process.env.TYPEORM_PASSWORD || '9592';
const host = process.env.TYPEORM_HOST || 'localhost';
const port = parseInt(process.env.TYPEORM_PORT, 10) || 5432;
const database = process.env.TYPEORM_DATABASE || 'bug_tracker';
module.exports = {
type,
url:
process.env.DATABASE_URL ||
`${type}://${username}:${password}@${host}:${port}/${database}`,
entities: [
process.env.NODE_ENV === 'test'
? 'src/entity/**/*.ts'
: 'build/entity/**/*.js',
],
migrations: [
process.env.NODE_ENV === 'test'
? 'src/migration/**/*.ts'
: 'build/migration/**/*.js',
],
cli: {
entitiesDir:
process.env.NODE_ENV === 'test' ? 'src/entity' : 'build/entity',
migrationsDir:
process.env.NODE_ENV === 'test' ? 'src/migration' : 'build/migration',
},
synchronize: false,
logging: false,
extra: {
ssl: {
rejectUnauthorized: false, // Disables SSL cert validation
ca: process.env.DB_CA_CERT, // Read CA cert from environment variable
},
},
};