mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:32:50 +08:00
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:
parent
76fdf2922a
commit
ffecbed43a
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user