Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plugins support for origins backwards compatibility mode #466

Closed
mikkokar opened this issue Oct 1, 2019 · 2 comments
Closed

Add plugins support for origins backwards compatibility mode #466

mikkokar opened this issue Oct 1, 2019 · 2 comments
Assignees

Comments

@mikkokar
Copy link
Contributor

mikkokar commented Oct 1, 2019

Description

Translate plugins configuration to routing objects, when the backwards compatibility mode (PR #458) is activated.

Background

PR #458 added a "backwards compatibility mode" for origins-file based application routing. In the backwards compatibility mode Styx configures its forwarding path according to origins.yaml but at the moment it doesn't support external plugins.

To conclude the backwards compatibility mode work, Styx must apply the plugins configuration (in styx server configuration) to the forwarding path.

Detailed Description

The plugins are loaded from the styx server configuration, and they will be available in StyxServerComponents class. But they are not automatically applied to the forwarding path when object based routing is used. Styx wouldn't know where to apply them. The plugins would have to be inserted at a desirable point in the forwarding path using the InterceptorPipeline object.

In the backwards compatibility mode the plugins should be applied at the beginning of the HTTP pipeline. We should create an InterceptorPipeline object, configure this with the plugins, and insert the object in HTTP pipeline root, just before the PathPrefixRouter object. The forwarding path will thus look like this:

routingObjects:
  root:
    type: HttpPipelineHandler
    config:
       plugins:
        - firstPlugin
        - secondPlugin
        - andSoOn
        - theLastPlugin
       handler: pathPrefixRouter

httpPipeline: root

Acceptance Criteria

  • A HttpPipelineHandler is created for the plugins, and inserted as httpPipeline root object.
  • The HttpPipelineHandler pipeline contains the plugins in the order described by plugins.all attribute.
  • The HttpPipelineHandler handler attribute points to the PathPrefixRouter object.
  • The HttpPipelineHandler shall be called pluginPipeline. An end-user needs to use this name to route traffic to it. Like so:

httpPipeline: pluginPipeline

  • Plugins reload is not supported. A server restart is required to reload the plugins.
@mikkokar
Copy link
Contributor Author

mikkokar commented Oct 1, 2019

This doesn't necessarily need any code changes. The end-user can still configure his or her httpPipeline root with HttpInterceptorPipeline:

plugins:
  all:
    plugA: ...
    plugB: ... 
    plugC: ...

httpPipeline:
  type: HttpInterceptorPipeline:
  config:
    pipeline:
      - plugA
      - plugB
      - plugC
    handler: pathPrefixRouter

I recon this should work.

@mikkokar mikkokar assigned mikkokar and unassigned OwenLindsell Oct 9, 2019
@mikkokar
Copy link
Contributor Author

Fixed by: #475

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

No branches or pull requests

2 participants