-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorm.config.ts
26 lines (23 loc) · 867 Bytes
/
orm.config.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
import { TypeOrmModuleOptions } from '@nestjs/typeorm'
const { DataSource } = require('typeorm')
const { ConfigService } = require('@nestjs/config')
const { config } = require('dotenv')
config({ path: __dirname + '/.env.development', debug: true })
const configService = new ConfigService()
console.log(process.env.DB_DATABASE)
export const typeOrmConfig: TypeOrmModuleOptions = new DataSource({
ssl: true,
type: 'postgres',
host: configService.getOrThrow('DB_HOST'),
port: configService.getOrThrow('DB_PORT'),
username: configService.getOrThrow('DB_USERNAME'),
password: configService.getOrThrow('DB_PASSWORD'),
database: configService.getOrThrow('DB_DATABASE'),
entities: ['src/**/*.entity.js'],
migrations: ['src/migrations/*.js'],
// migrationsRun: true,
cli: {
migrationsDir: __dirname + '/migrations',
},
synchronize: false,
})