How to access Ocelot config outside of Ocelot pipeline? #1871
-
Is there a way to access the strongly typed Ocelot configuration from outside of the Ocelot pipeline in a delegating handler or middleware, maybe have it injected via DI? I've run into a situation where I need to grab a config value based on a part of the upstream path. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
We have the issue #738 exactly for that, is gonna take a while though... |
Beta Was this translation helpful? Give feedback.
-
Gotcha, thank you! |
Beta Was this translation helpful? Give feedback.
-
Hey @rwestonbutler and @margaale! |
Beta Was this translation helpful? Give feedback.
-
@rwestonbutler on Jan 16, 2019:
Please try to inject the following interface objects:
Hope it helps! |
Beta Was this translation helpful? Give feedback.
@rwestonbutler on Jan 16, 2019:
Please try to inject the following interface objects:
IInternalConfiguration
: see usage and code. It hasRoutes
property and you have to find your route mannually.IOptionsMonitor<IInternalConfiguration>
: see usage and code. But it requires to write valid path to extract.IOptions<FileConfiguration>
: see usage and code. Seems it is the best option!Hope it helps!
Let us know your testing results please!