Ocelot not finding reroutes files Ocelot not finding reroutes files docker docker

Ocelot not finding reroutes files


Not sure if this is what you are looking for? This is the way Ocelot merges multiple routing files together

https://ocelot.readthedocs.io/en/latest/features/configuration.html#merging-configuration-files

We don't use this but this is how we have our startup defined:

var builder = new ConfigurationBuilder()                .SetBasePath(env.ContentRootPath)                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)                .AddJsonFile(this.env.IsDevelopment() ? "ocelot.json" : "ocelot.octopus.json")                .AddEnvironmentVariables();

So we have our standard appSettings plus the Ocelot one we use that Octopus will transform various variables we want when our Ocelot instance is deployed out into our test/production envs (or just our test/local one).

This seems to be the bit that defines what to do for multiple files:

In this scenario Ocelot will look for any files that match the pattern (?i)ocelot.([a-zA-Z0-9]*).json and then merge these together. If you want to set the GlobalConfiguration property you must have a file called ocelot.global.json.

Not sure if you need to explicitly define each file (unless they can be defined via a variable like {env.EnvironmentName}) but that should be easy enough to test.

Sorry if I have got the wrong end of the stick but hope this helps.