forked from NarHakobyan/awesome-nest-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig.js
32 lines (28 loc) · 944 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
/* tslint:disable:quotemark object-literal-sort-keys */
import * as dotenv from 'dotenv';
import { SnakeNamingStrategy } from './src/snake-naming.strategy';
if (!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}',
],
};