-
Notifications
You must be signed in to change notification settings - Fork 2
/
ormconfig.js
38 lines (36 loc) · 960 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
const baseConfig =
process.env.NODE_ENV === 'development'
? {
entities: [`${__dirname}/src/database/entities/**/*.ts`],
migrations: [`${__dirname}/src/database/migrations/*.ts`],
}
: {
entities: [`${__dirname}/build/database/entities/**/*.js`],
migrations: [`${__dirname}/build/database/migrations/*.js`],
};
const baseOptions = {
...baseConfig,
cli: {
migrationsDir: `${__dirname}/src/database/migrations`,
entitiesDir: `${__dirname}/src/database/entities`,
},
host: process.env.DB_HOST,
logging: false,
password: process.env.DB_PASS,
port: 5432,
type: 'postgres',
username: process.env.DB_USER,
autoLoadEntities: true,
name: process.env.DB_NAME,
database: process.env.DB_NAME,
synchronize: true,
ssl: {
rejectUnauthorized: false,
},
};
module.exports = [
Object.assign({}, baseOptions, {
synchronize: true,
logging: process.env.LOG === '1',
}),
];