porcx
03/22/2022, 11:05 AMconfigService
in nest js helps to get the env vars when injected. Somethig like this in app.module.ts
TypeOrmModule.forRootAsync({
useFactory:async (config: ConfigService) => ({
type: 'postgres',
host: config.get('POSTGRES_HOST'),
port: config.get('POSTGRES_PORT'),
username: config.get('POSTGRES_USER'),
password: config.get('POSTGRES_PASSWORD'),
database: config.get('POSTGRES_DATABASE'),
}),
inject: [ConfigService]
})
I want to do something similar to AuthModule as well