Skip to content

introduce Rhai script module for request/response handling#335

Open
jimbirthday wants to merge 7 commits intoferronweb:develop-2.xfrom
jimbirthday:develop-2.x
Open

introduce Rhai script module for request/response handling#335
jimbirthday wants to merge 7 commits intoferronweb:develop-2.xfrom
jimbirthday:develop-2.x

Conversation

@jimbirthday
Copy link

@jimbirthday jimbirthday commented Dec 11, 2025

feat(script): introduce Rhai script module for request/response handling

This commit adds a new ferron-script module that allows users to define and execute Rhai scripts within the Ferron server. The module supports various triggers such as on_request_start and on_response_ready, enabling dynamic request handling and response modification. Additionally, it includes configuration options for script limits and failure policies, enhancing the server's extensibility and flexibility.

New files include:

  • ferron-script crate with core functionality
  • Example scripts for authentication and response modification
  • Documentation for the script module and testing guidelines

#317

This commit adds a new `ferron-script` module that allows users to define and execute Rhai scripts within the Ferron server. The module supports various triggers such as `on_request_start` and `on_response_ready`, enabling dynamic request handling and response modification. Additionally, it includes configuration options for script limits and failure policies, enhancing the server's extensibility and flexibility.

New files include:
- `ferron-script` crate with core functionality
- Example scripts for authentication and response modification
- Documentation for the script module and testing guidelines

Also updated `.gitignore` to exclude build artifacts and added `AGENTS.md` for repository guidelines.
@jimbirthday
Copy link
Author

@DorianNiemiecSVRJS Can you review the code?

This commit updates the `Cargo.lock` to include the `const-hex` package and removes the previously defined `const-hex` entry. Additionally, it cleans up the `Cargo.toml` by removing the `tokio-test` dependency from the `ferron-script` module and deletes the unused `build_with_modules.rs` file, streamlining the project structure.
@DorianNiemiecSVRJS DorianNiemiecSVRJS added the rust Pull requests that update rust code label Dec 18, 2025
@jimbirthday jimbirthday force-pushed the develop-2.x branch 4 times, most recently from ac9ff54 to c4b490d Compare December 22, 2025 09:45
@jimbirthday
Copy link
Author

What do I need to do next? @DorianNiemiecSVRJS

@DorianNiemiecSVRJS
Copy link
Member

Thank you for creating the pull request! And apologies for a bit late response...

I actually had a similar idea with a scripting module when I was working on Ferron 2 when it was still beta - except I thought of using a different scripting language (Lua). But I ended up putting off the implementation of the concept to what it would be some later version after the Ferron 2 launch...

@DorianNiemiecSVRJS Can you review the code?

Yes, I'm going to review your PR after I release a next version of Ferron (2.2.2), hopefully soon. The Rhai scripting functionality will probably be in Ferron 2.3.0, after I merge your PR.

@DorianNiemiecSVRJS
Copy link
Member

DorianNiemiecSVRJS commented Jan 7, 2026

So, I have released the new version of Ferron (which turned out to be 2.3.x, because I made quite some changes), and I'm going to review your PR soon. If it gets merged, the change is going to land in Ferron 2.4.0 (probably)! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants