Is there any way of doing this?... I tried with merging files but does not working because I have the same UpstreamPathTemplate and I only change the DownstreamHostAndPorts, Ocelot only take a ocelot.json or look for files that match the pattern (?i)ocelot.([a-zA-Z0-9]*).json and then merge these together.
I also tried adding only the corresponding file to the environment:
.ConfigureAppConfiguration((host, config) =>
{
config
.SetBasePath(host.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{host.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile($"ocelot.{host.HostingEnvironment.EnvironmentName.ToLower()}.json")
.AddOcelot(host.HostingEnvironment)
.AddEnvironmentVariables();
}).UseStartup<Startup>();
but still does not working, thanks in advance.
I have a module that I plan on pushing that will address this issue, but it is currently in progress. It will allow you to treat DownstreamHostAndPorts as a ServiceName instead and you can load the service hosts as an environment specific configuration. Until then, there are a couple of workarounds:
Most helpful comment
I have a module that I plan on pushing that will address this issue, but it is currently in progress. It will allow you to treat DownstreamHostAndPorts as a ServiceName instead and you can load the service hosts as an environment specific configuration. Until then, there are a couple of workarounds: