chore: remove obsolete ChartServiceHealthCheck and ChartService config (chart now generated internally)
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -27,16 +27,9 @@ builder.Services.AddMemoryCache(options =>
|
|||||||
options.SizeLimit = 200 * 1024 * 1024; // 200 MB max
|
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
|
// Health checks
|
||||||
builder.Services.AddHealthChecks()
|
builder.Services.AddHealthChecks()
|
||||||
.AddCheck<DatabaseHealthCheck>("database", tags: new[] { "db", "ready" })
|
.AddCheck<DatabaseHealthCheck>("database", tags: new[] { "db", "ready" });
|
||||||
.AddCheck<ChartServiceHealthCheck>("chart-service", tags: new[] { "external", "ready" });
|
|
||||||
|
|
||||||
// Registra i servizi applicativi
|
// Registra i servizi applicativi
|
||||||
builder.Services.AddScoped<ICertificateDataService, CertificateDataService>();
|
builder.Services.AddScoped<ICertificateDataService, CertificateDataService>();
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
"Syncfusion": {
|
"Syncfusion": {
|
||||||
"LicenseKey": "Ngo9BigBOggjGyl/VkV+XU9AclRDX3xKf0x/TGpQb19xflBPallYVBYiSV9jS3hTdURrWH9ccXRUQmhUUE91XA=="
|
"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": {
|
"CryptoSettings": {
|
||||||
"Passphrase": "ddCE3hM9BNJXgwtj"
|
"Passphrase": "ddCE3hM9BNJXgwtj"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user