DocSpace-client/common/ASC.Api.Core/Core/BaseWorkerStartup.cs

36 lines
1.0 KiB
C#
Raw Normal View History

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