https://github.com/angryboat/actionlimiter
Redis backed Token Bucket rate limiting
https://github.com/angryboat/actionlimiter
middleware rails ruby
Last synced: 2 months ago
JSON representation
Redis backed Token Bucket rate limiting
- Host: GitHub
- URL: https://github.com/angryboat/actionlimiter
- Owner: angryboat
- License: mit
- Created: 2021-06-03T03:14:37.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-11T00:03:10.000Z (over 3 years ago)
- Last Synced: 2025-01-22T17:06:24.085Z (over 1 year ago)
- Topics: middleware, rails, ruby
- Language: Ruby
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ActionLimiter
[](https://github.com/angryboat/actionlimiter/actions/workflows/ruby-gem.yml)
Provides Redis backed rate limiting for Rails applications.
## Installing
```shell
gem install actionlimiter
```
```shell
bundle add actionlimiter
```
## Usage
### Set Redis URL
```ruby
Rails.application.configure do |config|
config.redis = { url: 'redis://localhost:6379/0' }
end
```
### Rails IP Middleware
```ruby
Rails.application.configure do |config|
# Limit a single IP to 20 requests in a 5 second period.
config.middleware.use(ActionLimiter::Middleware::IP, period: 5, size: 20)
end
```