-
Notifications
You must be signed in to change notification settings - Fork 863
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
Expose immutable Metadata from RouteConfig #476
Conversation
@@ -49,6 +51,8 @@ internal sealed class RouteConfig | |||
|
|||
public Transforms Transforms { get; } | |||
|
|||
public IReadOnlyDictionary<string, string> Metadata { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this help you when RouteConfig itself is still internal? You'd probably need to flow the data somewhere accessible like IReverseProxyFeature:
context.Features.Set<IReverseProxyFeature>(new ReverseProxyFeature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. I saw RouteConfig pop up in the debugger and when I opened it it didn't expose metadata so I decided to add it but I didn't notice that the whole class was internal. Ok, thanks for clarifying it, I'll try to find another way. Although in general it would be very helpful to have runtime access to the original configuration that was used to create a route
For reference, can you get an example of the kind of information you are adding to the route metadata? |
Sure. I'm still in a process of estimating yarp and I'm working on a POC that has the functionality that is currently used in production. I'm thinking on separating configuration from the RP itself so that I don't need to update RP every time I add new route. It should look like this
I want combined json config to be a standard config for RP, no additional stuff. That means currently that I need to rely on metadata if I want something custom (transform extensibility isn't there yet). Something custom is for example a transformation that is not available in RP now or another middleware that I want to activate on the route. For example I want to short circuit certain paths and don't let them go through. I add metadata item
So I want to reuse existing ProxyRoute structure to add functionality and I need an access to this additional data |
After #328 got merged, you could add your custom metadata to YARP endpoints. |
@Kahbazi I think they're asking about different metadata in this case. Endpoint.Metadata is a routing concept, but RouteConfig.Metadata is just extra config input. |
@Tratcher I was thinking about adding ProxyRoute.Metadata directly to Endpoint.Metadata or creates an object from ProxyRoute.Metadata and add it to Endpoint.Metadata in |
Since extensibility of the yarp is work in progress yet I use Metadata to add some additional information that I can later use to run my own middelware. Without Metadata being accessible through Endpoint->Metadata->RouteConfig->Metadata I need to build my own store for metadata which is unfortunate because I already have everything.