Using config to determine whether to use ThrottleRequests or ThrottleRequestsWithRedis #50930
Unanswered
Propaganistas
asked this question in
Q&A
Replies: 1 comment
-
Did you find a solution here? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How would you go to make the
throttle
middleware dynamic based on its environment (availability of redis)?ThrottleRequests
vsThrottleRequestsWithRedis
This blows everything up:
This works, but I'm wondering if directly calling
env()
is desired...The above is Laravel 11 code, but it applies as well to older Laravel versions using a HttpKernel.
I know it could be done in a ServiceProvider's
boot()
method by revisiting and replacing the already registeredthrottle
alias, but I'm somehow tempted to try to register it early on properly...Beta Was this translation helpful? Give feedback.
All reactions