refactor(Program): update to scan all appsettings.*.json's

This commit is contained in:
tekh 2025-09-29 09:26:23 +02:00
parent 7e1ef838d7
commit 737df03f01

View File

@ -34,6 +34,12 @@ try
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[]>() ??
throw new InvalidOperationException("AllowedOrigins section is missing in the configuration.");