router icon indicating copy to clipboard operation
router copied to clipboard

Modify the router to add support for binary plugins

Open garypen opened this issue 3 years ago • 3 comments

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 avatar Aug 29 '22 15:08 garypen

@garypen your pull request is missing a changelog!

github-actions[bot] avatar Aug 29 '22 15:08 github-actions[bot]

@garypen, please add a /NEXT_CHANGELOG.md entry for this PR to the appropriate section!

github-actions[bot] avatar Nov 22 '22 15:11 github-actions[bot]

@garypen, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

github-actions[bot] avatar Feb 23 '23 15:02 github-actions[bot]