-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
30 lines (25 loc) · 1002 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
if (process.env.NODE_ENV !== 'production') require('dotenv').config()
const path = require('path')
const folderPath = process.env.NODE_ENV === 'production' ? 'dist' : 'src'
const entities = path.join(__dirname, `${folderPath}/models`, `*.{ts,js}`)
const migrations = path.join(__dirname, `${folderPath}/migrations`, `*.{ts,js}`)
module.exports = {
type: 'postgres',
url: process.env.DATABASE_URL,
// host: process.env.DB_HOST || '',
// port: process.env.DB_PORT || 5432,
// username: process.env.DB_USERNAME,
// password: process.env.DB_PASSWORD || '',
// database: process.env.DB_NAME,
entities: [entities],
migrations: [migrations],
migrationsRun: true,
seeds: [`${folderPath}/seeds/**/*.{ts,js}`],
factories: [`${folderPath}/factories/**/*.{ts,js}`],
synchronize: false,
extra: process.env.NODE_ENV === 'production' ? {ssl: { rejectUnauthorized: false, }} : {},
cli: {
entitiesDir: `${folderPath}/models`,
migrationsDir: `${folderPath}/migrations`,
}
}