Skip to content

Instantly share code, notes, and snippets.


Ambroise Rabier ambroiseRabier

View GitHub Profile
joseluisq / database.module.ts
Last active Jun 10, 2021
Nest Database Module (Type ORM) with environment variables support
View database.module.ts
import { Module, Global, DynamicModule } from '@nestjs/common'
import { EnvModule } from './env.module'
import { EnvService } from './env.service'
import { TypeOrmModule } from '@nestjs/typeorm'
function DatabaseOrmModule (): DynamicModule {
const config = new EnvService().read()
return TypeOrmModule.forRoot({
type: config.DB_TYPE,