OPC # 0009: Fix Worker gitea HttpClient missing token and base URL
controlplane/build ✔ Build succeeded.

This commit is contained in:
amadzarak
2026-04-26 16:15:05 -04:00
parent 13ff5eb926
commit ff7fa8e812
2 changed files with 10 additions and 9 deletions
+8 -2
View File
@@ -27,8 +27,14 @@ builder.Services.AddKeycloakAdminHttpClient(o =>
// Custom admin client - handles realm creation, roles, role assignment (not in SDK)
builder.Services.AddSingleton<KeycloakAdminClient>();
// Named HttpClient for Gitea commit status API (self-signed cert)
builder.Services.AddHttpClient("gitea").ConfigurePrimaryHttpMessageHandler(() =>
// Named HttpClient for Gitea commit status API (self-signed cert + token auth)
builder.Services.AddHttpClient("gitea", (sp, client) =>
{
var cfg = sp.GetRequiredService<IConfiguration>();
client.BaseAddress = new Uri(cfg["Gitea:BaseUrl"] ?? "https://opc.clarity.test");
client.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("token", cfg["Gitea:Token"]);
}).ConfigurePrimaryHttpMessageHandler(() =>
new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
// opcdb for build/release history tracking