Fix to AddOcelot(), Config File Merge (#970)

* [develop]:
Added more functionality to configuration files as suggested by CesarD

* [develop]:
Clean up
This commit is contained in:
rjwester 2019-07-28 11:01:17 -04:00 committed by Thiago Loureiro
parent 76fdf2922a
commit ffecbed43a

View File

@ -40,15 +40,13 @@ namespace Ocelot.DependencyInjection
const string globalConfigFile = "ocelot.global.json";
const string subConfigPattern = @"^ocelot\.[a-zA-Z0-9]+\.json$";
string excludeConfigName = env?.EnvironmentName != null ? $"ocelot.{env.EnvironmentName}.json" : string.Empty;
string subConfigPattern = $@"^ocelot\.([a-zA-Z0-9]+|[a-zA-Z0-9]+\.{env?.EnvironmentName})\.json$";
var reg = new Regex(subConfigPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
var files = new DirectoryInfo(folder)
.EnumerateFiles()
.Where(fi => reg.IsMatch(fi.Name) && (fi.Name != excludeConfigName))
.Where(fi => reg.IsMatch(fi.Name))
.ToList();
var fileConfiguration = new FileConfiguration();