router
router copied to clipboard
Modify the router to add support for binary plugins
DO NOT MERGE - THIS IS A POC ONLY
This POC adds support for binary plugins to the router.
The router scans for binary plugins in the "./target/release" directory. Any plugins are loaded into the router and made part of the plugin processing chain.
Configuration is hard-coded in the router and only the two example libraries are currently supported.
The POC does the interesting parts of the "adding support for binary plugins to the router". The bits remaining for productisation include:
- managing versions (router and plugins)
- providing configuration to the plugin
- interaction with the state machine
To run this:
cd examples/bin-hello-world && cargo build --release; cd - cd examples/bin-forbid-anonymous-operations && cargo build --release; cd - RUST_LOG=info cargo run --release -- -s examples/graphql/local.graphql
Then you can interact with the router at http://127.0.0.1:4000 as usual
Because we have the "forbid-anonymous-operations" plugin inactive, you'll see a response like this:
{"errors":[{"message":"Anonymous operations are not allowed","locations":[],"path":null}]}%
@garypen your pull request is missing a changelog!
@garypen, please add a /NEXT_CHANGELOG.md entry for this PR to the appropriate section!
@garypen, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.