Implement US-12 consolidated health overview service

This commit is contained in:
Steffen committed 2026-10-05 14:36:28 +02:00
1 parent cc76c9bde4
commit 076e675c81
26 files changed
+804 -16

No files matched your search

+11 -2
View File
@@ -62,11 +62,20 @@ public class Program
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false });
builder.Services.AddHttpClient("HealthOverview", (services, client) =>
{
var configuration = services.GetRequiredService<IConfiguration>();
client.BaseAddress = GetBaseUri(configuration, "HealthOverview");
client.DefaultRequestHeaders.Add("X-Gateway-Key", configuration["Services:HealthOverview:Key"]);
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false });
var app = builder.Build();
_ = GetBaseUri(app.Configuration, "PatientProfile");
_ = GetBaseUri(app.Configuration, "Observation");
_ = GetBaseUri(app.Configuration, "Insights");
foreach (var key in new[] { "Services:PatientProfile:Key", "Services:Observation:Key", "Services:Insights:Key", "InternalAccess:Observation:Key", "InternalAccess:Insights:Key" })
_ = GetBaseUri(app.Configuration, "HealthOverview");
foreach (var key in new[] { "Services:PatientProfile:Key", "Services:Observation:Key", "Services:Insights:Key", "Services:HealthOverview:Key", "InternalAccess:HealthOverview:Key", "InternalAccess:Observation:Key", "InternalAccess:Insights:Key" })
if (string.IsNullOrWhiteSpace(app.Configuration[key]) || app.Configuration[key]!.Length < 32)
throw new InvalidOperationException($"{key} must contain at least 32 characters.");
if (string.IsNullOrWhiteSpace(app.Configuration["Authentication:KeyDirectory"]))
@@ -74,7 +83,7 @@ public class Program
var lifetime = app.Configuration.GetValue("Authentication:TokenLifetimeMinutes", 30);
if (lifetime <= 0 || lifetime > 1440) throw new InvalidOperationException("Token lifetime must be between 1 and 1440 minutes.");
if (!app.Environment.IsDevelopment())
foreach (var service in new[] { "PatientProfile", "Observation", "Insights" })
foreach (var service in new[] { "PatientProfile", "Observation", "Insights", "HealthOverview" })
if (GetBaseUri(app.Configuration, service).Scheme != "https")
throw new InvalidOperationException("Production service endpoints must use HTTPS.");
_ = app.Services.GetRequiredService<PrototypeAccounts>();