refactor(Program): update to scan all appsettings.*.json's
This commit is contained in:
parent
7e1ef838d7
commit
737df03f01
@ -34,6 +34,12 @@ try
|
|||||||
|
|
||||||
var config = builder.Configuration;
|
var config = builder.Configuration;
|
||||||
|
|
||||||
|
Directory
|
||||||
|
.GetFiles(builder.Environment.ContentRootPath, "appsettings.*.json", SearchOption.TopDirectoryOnly)
|
||||||
|
.Where(file => Path.GetFileName(file) != $"appsettings.Development.json")
|
||||||
|
.ToList()
|
||||||
|
.ForEach(file => config.AddJsonFile(file, true, true));
|
||||||
|
|
||||||
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
||||||
throw new InvalidOperationException("AllowedOrigins section is missing in the configuration.");
|
throw new InvalidOperationException("AllowedOrigins section is missing in the configuration.");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user