michalmuskala / michalmuskala/plug_attack
Override init/1 to pass options into the rule macro
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 455
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to override the init function and make available those options into the rule macro?
Use case:
init/1 runs at compile time, and allows to set calculations into the options that cannot be computed in a module attribute definition. Lets say I want to compile some patterns in compile time using the :binary.compile_pattern(["some", "nice", "patterns"]) to later use them into some function. That cannot be done in a module attribute since it only support specific values easy to escape. Init would be the way to go then, but the options won't be available into the rule macro, and I don't won't to override also the call/2 function to assign those values into the conn, since that computation doesn't relate to the conn at all.
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the init/1, rule macro, and call/2 entry points described in the issue. Determine whether compile-time options can be made available to rule without assigning them through call/2; done means the supported behavior and its scope are clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100