2022-02-03 13:19:48 +00:00
|
|
|
|
namespace ASC.Api.Core;
|
2021-10-28 10:23:26 +00:00
|
|
|
|
|
2022-02-03 13:19:48 +00:00
|
|
|
|
public class BaseWorkerStartup
|
|
|
|
|
{
|
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
|
|
|
|
|
|
public BaseWorkerStartup(IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
Configuration = configuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void ConfigureServices(IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddHttpContextAccessor();
|
|
|
|
|
services.AddCustomHealthCheck(Configuration);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Configure(IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
|
|
|
|
|
app.UseEndpoints(endpoints =>
|
2021-10-28 10:23:26 +00:00
|
|
|
|
{
|
2022-02-03 13:19:48 +00:00
|
|
|
|
endpoints.MapHealthChecks("/health", new HealthCheckOptions()
|
|
|
|
|
{
|
|
|
|
|
Predicate = _ => true,
|
|
|
|
|
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
|
|
|
|
|
});
|
|
|
|
|
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions
|
|
|
|
|
{
|
|
|
|
|
Predicate = r => r.Name.Contains("self")
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-06-16 13:54:36 +00:00
|
|
|
|
}
|