Skip to content

Feature Request -- Optional Custom Client as input params #116

@jbool24

Description

@jbool24

It would be great to be able to pass in an existing client if the project is already using Mongo instead of maintaining the client connection internally.

// Throttler
@Module({
  imports: [
    ThrottlerModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService, DBService],
      useFactory: (config: ConfigService, db: DBService) => [
        {
          ttl: config.get('THROTTLE_FRAME_TTL_IN_MILLISECONDS', 4000),
          limit: config.get('THROTTLE_REQUEST_PER_FRAME_LIMIT', 50),
          storage: new ThrottlerStorageMongoService( db.getClient() ) // <-- connection string or allow Client object as input ??
        },
      ],
    }),
  ],
})
export class AppModule {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions