A simple rate limiting application for demo purposes only. Previously, it only supports ETS but now it supports distributed DB with Mnensia and libcluster to handle node joining cluster. Goal is to make this configurable with different backends.
If available in Hex, the package can be installed
by adding rate_limiting
to your list of dependencies in mix.exs
:
Tested on Elixir v1.10.1
def deps do
[
{:rate_limiting, "~> 0.1.5"}
]
end
To configure request count and duration:
config :rate_limiting,
interval_seconds: 60,
max_requests_count: 100
# Required config for mnesia disc mode
config :mnesia,
dir: '.mnesia/#{Mix.env()}/#{node()}'
Add tests!!!!
For an example, please see https://github.com/lenfree/rate_limiting/tree/master/example.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rate_limiting.