-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig.ts
30 lines (24 loc) · 881 Bytes
/
ormconfig.ts
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
import './src/boilerplate.polyfill';
import * as dotenv from 'dotenv';
import { SnakeNamingStrategy } from './src/snake-naming.strategy';
if (!(<any>module).hot /* for webpack HMR */) {
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
}
dotenv.config({
path: `.${process.env.NODE_ENV}.env`,
});
// Replace \\n with \n to support multiline strings in AWS
for (const envName of Object.keys(process.env)) {
process.env[envName] = process.env[envName]?.replace(/\\n/g, '\n');
}
module.exports = {
type: 'postgres',
host: process.env.POSTGRES_HOST,
port: process.env?.POSTGRES_PORT,
username: process.env.POSTGRES_USERNAME,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DATABASE,
namingStrategy: new SnakeNamingStrategy(),
entities: ['src/modules/**/*.entity{.ts,.js}'],
migrations: ['src/migrations/*{.ts,.js}'],
};