chore: remove obsolete ChartServiceHealthCheck and ChartService config (chart now generated internally)

This commit is contained in:
2026-05-27 18:51:27 +02:00
parent 30d33a147a
commit 336e0eb3b8
3 changed files with 1 additions and 46 deletions

View File

@@ -33,37 +33,3 @@ public class DatabaseHealthCheck : IHealthCheck
}
}
/// <summary>
/// Verifica connettività al servizio chart esterno.
/// </summary>
public class ChartServiceHealthCheck : IHealthCheck
{
private readonly IHttpClientFactory _httpClientFactory;
private readonly string _baseUrl;
public ChartServiceHealthCheck(IHttpClientFactory httpClientFactory, IConfiguration config)
{
_httpClientFactory = httpClientFactory;
_baseUrl = config["ChartService:BaseUrl"] ?? "";
}
public async Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(_baseUrl))
return HealthCheckResult.Degraded("ChartService:BaseUrl non configurato.");
try
{
var client = _httpClientFactory.CreateClient("ChartService");
var response = await client.GetAsync(_baseUrl, cancellationToken);
return response.IsSuccessStatusCode
? HealthCheckResult.Healthy("Chart service raggiungibile.")
: HealthCheckResult.Degraded($"Chart service risponde con status {response.StatusCode}.");
}
catch (Exception ex)
{
return HealthCheckResult.Degraded("Chart service non raggiungibile.", ex);
}
}
}

View File

@@ -27,16 +27,9 @@ builder.Services.AddMemoryCache(options =>
options.SizeLimit = 200 * 1024 * 1024; // 200 MB max
});
// HttpClient factory per chiamate al chart service
builder.Services.AddHttpClient("ChartService", client =>
{
client.Timeout = TimeSpan.FromSeconds(30);
});
// Health checks
builder.Services.AddHealthChecks()
.AddCheck<DatabaseHealthCheck>("database", tags: new[] { "db", "ready" })
.AddCheck<ChartServiceHealthCheck>("chart-service", tags: new[] { "external", "ready" });
.AddCheck<DatabaseHealthCheck>("database", tags: new[] { "db", "ready" });
// Registra i servizi applicativi
builder.Services.AddScoped<ICertificateDataService, CertificateDataService>();

View File

@@ -5,10 +5,6 @@
"Syncfusion": {
"LicenseKey": "Ngo9BigBOggjGyl/VkV+XU9AclRDX3xKf0x/TGpQb19xflBPallYVBYiSV9jS3hTdURrWH9ccXRUQmhUUE91XA=="
},
"ChartService": {
"BaseUrl": "https://reports.smart-roots.net:4004",
"ChartEndpoint": "/ChartFSWeb.aspx?width=800&height=600&isin={0}&tipo=pdf"
},
"CryptoSettings": {
"Passphrase": "ddCE3hM9BNJXgwtj"
},