Reducing boilerplate
There's an interesting alternative to the injection of the configuration namespace in the dynamic module.
export default registerAs('database', () => {
const config = {
type: 'postgres',
url: process.env.DATABASE_URL,
autoLoadEntities: true,
} as const satisfies TypeOrmModuleOptions;
return config;
});TypeOrmModule.forRootAsync(databaseConfig.asProvider())Last updated