Steward is an implementation of the Lyft Rate-Limit service.
- Load rate limit configs from HTTP or a local file
- Docker
- Docker-compose
- Make
- Rust toolchain
Simple execute cargo build --release
to create a binary
which, when run, will start the rate limit service as a
gRPC server.
The environment can be brought up with make run
.
It includes an envoy proxy, the rate limit service, a redis
database, a mock configuration server, and a httpbin backend.
The project uses tavern HTTP integration tests.
They can be executed with make test
The path to local configuration can be specified using the
environment variable STEWARD_CONFIG_PATH
.
The default location is steward.yaml
in the current working
directory.
Example configuration file:
listen:
addr: 0.0.0.0
port: 5001
rate_limit_configs:
http: http://mock_config:8000/api/rate_limits
redis_host: redis
redis_connections: 8
default_ttl: 10
This parameter allows specifying a location for the service to lookup various rate limit configurations.
Either a Http
or File
location can be specified.
Example of what the service expects the location to contain:
{
"domain": [
{
"key": "descriptor_key",
"value": "descriptor_value",
"rate_limit": {
"unit": "<seconds|minutes|hours|days|months|years>",
"requests_per_unit": 12345
}
}
]
}
There can be any number of domains and descriptors.