-
Notifications
You must be signed in to change notification settings - Fork 221
Closed
Description
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
@Module({
providers: [
DatabaseService,
],
exports: [
DatabaseService,
],
imports: [
TypeOrmModule.forRootAsync({
useFactory: async (config: ConfigService) => {
const options = config.get('database.databases.email');
options.name = 'default';
options.entities = [__dirname + '/../app/entities/*.entity{.ts,.js}'];
return options;
},
inject: [ConfigService],
}),
TypeOrmModule.forRootAsync({
useFactory: async (config: ConfigService) => {
console.log('I AM IGNORED');
const options = config.get('database.databases.app');
options.name = 'app';
options.entities = [__dirname + '/../app/entities/*.entity{.ts,.js}'];
return options;
},
inject: [ConfigService],
}),
],
})
Expected behavior
Nest only load's first import. The second one is ignored. The module should load all async modules.
BTW. Maybe it would be better if module can accept array of connection options?
Environment
Nest version: 5.3.7
For Tooling issues:
- Node version: v9.4.0
- Platform: Mac
Others:
Metadata
Metadata
Assignees
Labels
No labels