Using NimbleOptions to Handle Regex and String Routes in Phx2ban

23
clicks
Using NimbleOptions to Handle Regex and String Routes in Phx2ban

Source: peterullrich.com

Type: Post

In this article, the author shares a quick guide on enhancing the Phx2ban application by allowing users to specify routes to be ignored using both strings and regex patterns. The author explains the step taken to utilize NimbleOptions for validating these configurations, highlighting the realization that the ~r notation in Elixir is actually a Regex struct. By defining the NimbleOptions to accept a list that can contain either strings or Regex structs, the author was able to successfully validate the configuration input, ensuring users can effectively manage their routes.

© HashMerge 2024