Revert "Fix to AddOcelot(), Config File Merge (#970)" (#974)

This reverts commit ffecbed43a33d65280a8ce90f98819a5ca24473d.
This commit is contained in:
Thiago Loureiro 2019-07-28 23:27:27 +08:00 committed by GitHub
parent ffecbed43a
commit 60e3a3737a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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