halacious icon indicating copy to clipboard operation
halacious copied to clipboard

Use of apiServerLabel and server selection - halacious doesn't work with multiple connections

Open irothschild opened this issue 5 years ago • 0 comments

There is a problem when using the halacious plugin on a server configured with multiple connections.

  1. internals.route call to server.lookup() fails because it is not allowed on multiple connections. I'm not sure of other use cases but for me, my public API is specified with the apiServerLabel option (which are the links I want to present, no matter which connection I receive a request on) so I have changed the call to selection.lookup().

  2. I'm not sure of the reason for selection.ext('onPostHandler', internals.postHandler); using selection and not server. The plugin server.register() call already has an option to select which connections the plugin should apply to so using selection here seems like an error or redundancy at best. I have changed it to server.ext('onPostHandler', internals.postHandler); which allows me to use halacious on multiple connections but lookup routes on the canonical apiServerLabel connection.

These changes are in https://github.com/Clarify/halacious/tree/use-apiServerLabel-for-route-lookup If it seems useful, I can make a PR.

irothschild avatar Jan 11 '20 23:01 irothschild