Remove dependency on IConfigurationRoot in external service URL resolution
idg10 opened this issue · 0 comments
If a service enables external URL resolution with a call such as this:
services.AddExternalServices(
"ExternalServices",
externalServices =>
externalServices.AddExternalServiceWithEmbeddedDefinition<OperationsStatusOpenApiService>("OperationsStatus"));
this introduces a service dependency on IConfigurationRoot
. The AddExternalServices
method takes a configuration section name, and retrieves it directly from IConfigurationRoot
. The OpenApiExternalServices
class that it passes this to then goes on to read configuration values dynamically from the configuration section in question based on the argument to AddExternalServiceWithEmbeddedDefinition
.
So with the example above, it will look for an ExternalServices
section with an OperationsStatus
value. So we'd need a setting of the form ExternalServices:OperationsStatus
We've been trying to remove direct dependencies on IConfiguration
or IConfigurationRoot
from Corvus and Menes, partly because it can make it hard to discover what the expected configuration entries are, and also because it introduces complications with tests by requiring test code to supply an IConfiguration
instead of just passing in the values of interest. We should make it possible to use this without needing IConfiguration
either.