reparieren: App-Einstellungen so angeordnet, dass sie Consuemr-Apis erreichen können

This commit is contained in:
Developer 02 2025-01-15 12:58:42 +01:00
parent a66570bebb
commit cd4428b8f0
3 changed files with 14 additions and 4 deletions

View File

@ -13,10 +13,10 @@ using System.Security.Claims;
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
builder.Configuration.AddJsonFile("consumer-api.json", true, true);
var config = builder.Configuration;
var apiParams = config.Get<AuthApiParams>() ?? throw new InvalidOperationException("AuthApiOptions is missing or invalid in appsettings.");
// Add services to the container.

View File

@ -8,7 +8,7 @@ namespace DigitalData.Auth.API.Services
{
public static IServiceCollection AddConsumerApiServiceFromConfiguration(this IServiceCollection services, IConfiguration configuration, string key = "ConsumerAPIs")
{
var consumerApis = configuration.GetValue<IEnumerable<ConsumerApi>>("ConsumerAPIs") ?? throw new InvalidOperationException($"No Consumer list found in {key} in configuration.");
var consumerApis = configuration.GetSection("ConsumerAPIs").Get<List<ConsumerApi>>() ?? throw new InvalidOperationException($"No Consumer list found in {key} in configuration.");
services.AddSingleton(Options.Create(consumerApis));
services.AddSingleton<IConsumerApiService, ConfiguredConsumerApiService>();
return services;

View File

@ -35,5 +35,15 @@
"ApiRoute": "client"
}
]
}
},
"ConsumerAPIs": [
{
"Name": "WorkFlow.API",
"Password": "t3B|aiJ'i-snLzNRj3B{9=&:lM5P@'i<>L"
},
{
"Name": "DigitalData.UserManager.API",
"Password": "a098Hvu1-y29ep{KPQO]#>8TK+fk{O`_d"
}
]
}