-
Notifications
You must be signed in to change notification settings - Fork 1
/
ormconfig.js
38 lines (34 loc) · 979 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 basicConfig = {
type: 'postgres',
host: process.env.POSTGRES_HOST,
port: JSON.parse(process.env.POSTGRES_PORT),
username: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
synchronize: JSON.parse(process.env.PORSTRES_SYNCHRONIZE),
entities: ['dist/**/*.entity{.ts,.js}'],
};
const defaultConfig = {
...basicConfig,
name: 'default',
migrationsTableName: 'migration_table',
migrations: ['dist/database/migration/**/*{.ts,.js}'],
cli: {
entitiesDir: 'src',
migrationsDir: 'database/migration',
},
};
const seedsConfig = {
...basicConfig,
name: 'seeds',
migrationsTableName: 'seeds_migrations',
migrations: ['dist/database/seeds/**/*{.ts,.js}'],
cli: {
entitiesDir: 'src',
migrationsDir: 'database/seeds',
},
};
if (JSON.parse(process.env.POSTGRES_SSL_ENABLED)) {
basicConfig.ssl = { rejectUnauthorized: false };
}
module.exports = [defaultConfig, seedsConfig];