ex_limiter v0.1.0 ExLimiter.Plug View Source
Plug for enforcing rate limits. The usage should be something like
plug ExLimiter.Plug, scale: 1000, limit: 5
Additionally, you can pass in :bucket
or :consumes
as options, each of which
are 1-arity functions of a Plug.Conn.t
which determine the bucket for the rate limit
and the amount to consume. These default to the phoenix controller, action, and remote_ip
and 1 respectively.
Additionally, you can configure a custom limiter with
config :ex_limiter, ExLimiter.Plug, limiter: MyLimiter
and you can also configure the rate limited response with
config :ex_limiter, ExLimiter.Plug, fallback: MyFallback
MyFallback
needs to implement a function render_error(conn, :rate_limited)