DevSpaceAuth is a wrapper around Plug.BasicAuth with rate limiting.
It is designed to protect endpoints that are used only by developers.
Add dev_space_auth to your list of dependencies in mix.exs:
defdepsdo[{:dev_space_auth,github: "prosapient/dev_space_auth"}]end- Define a rate limiter module in your app:
defmoduleMyApp.RateLimitdouseHammer,backend: :etsend- Add it to your supervision tree (before the endpoint):
children=[MyApp.RateLimit,MyAppWeb.Endpoint]- Use the plug with the
rate_limiteroption:
pipeline:dev_space_authdoplugDevSpaceAuth,rate_limiter: MyApp.RateLimitend- Configure credentials:
config:dev_space_auth,username: "username",password: "password"