Use Service Discovery for Swagger Configuration
masterIf you use an Ocelot Service Discovery Provider, you can use the service name in your Swagger configuration instead of hardcoded hosts and ports. In the SwaggerEndPoints section, use the Service object containing the Name (matching the Ocelot ServiceName) and the Path to the swagger JSON.
"Routes": [
{
"DownstreamPathTemplate": "/api/{everything}",
"ServiceName": "projects",
"UpstreamPathTemplate": "/api/project/{everything}",
"UpstreamHttpMethod": [ "Get" ],
"SwaggerKey": "projects"
}
],
"SwaggerEndPoints": [
{
"Key": "projects",
"Config": [
{
"Name": "Projects API",
"Version": "v1",
"Service": {
"Name": "projects",
"Path": "/swagger/v1/swagger.json"
}
}
]
}
]