Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to create custom key generator for storage #1662

Closed
1 task done
VladStepanov opened this issue Sep 4, 2023 · 3 comments
Closed
1 task done

No way to create custom key generator for storage #1662

VladStepanov opened this issue Sep 4, 2023 · 3 comments

Comments

@VladStepanov
Copy link

VladStepanov commented Sep 4, 2023

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I just want to have a opportunity to generate my own key. Md5 hash is good, but in real life there may be situations then you should connect to your redis and check keys rl-*.
I can't believe that such a popular lib doesn't have such a simple thing.

Describe the solution you'd like

Global default customKey function

.forRoot({
  customKey (context) {}
})

Local customKey function

class ThrottlerFoo extends ThrottlerGuard {
  customKey (context) {}
}

Local function overrides global

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

In real life there may be situations then you should connect to your redis and check/drop constraints

@jmcdo29
Copy link
Member

jmcdo29 commented Sep 4, 2023

You can extend the ThrottlerGuard and override the generateKey method

@jmcdo29 jmcdo29 closed this as completed Oct 23, 2023
@yudikubota
Copy link

I think this should be highlighted in the documentation.

@micalevisk
Copy link
Member

@yudikubota feel free to open a PR to change that at https://github.com/nestjs/docs.nestjs.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants