* fix formatting rules * reformat ersatztv * reformat ersatztv.application * reformat ersatztv.core * refactor ersatztv.core.tests * reformat ersatztv.ffmpeg * reformat ersatztv.ffmpeg.tests * reformat ersatztv.infrastructure * cleanup infra mysql * cleanup infra sqlite * cleanup infra tests * cleanup ersatztv.scanner * cleanup ersatztv.scanner.tests * sln cleanup * update dependencies
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using ErsatzTV.Core.Errors;
|
|
using ErsatzTV.Core.Health;
|
|
using ErsatzTV.Core.Health.Checks;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace ErsatzTV.Infrastructure.Health.Checks;
|
|
|
|
public class ErrorReportsHealthCheck : BaseHealthCheck, IErrorReportsHealthCheck
|
|
{
|
|
private readonly IOptions<BugsnagConfiguration> _bugsnagConfiguration;
|
|
|
|
public ErrorReportsHealthCheck(IOptions<BugsnagConfiguration> bugsnagConfiguration) =>
|
|
_bugsnagConfiguration = bugsnagConfiguration;
|
|
|
|
public override string Title => "Error Reports";
|
|
|
|
public Task<HealthCheckResult> Check(CancellationToken cancellationToken)
|
|
{
|
|
if (_bugsnagConfiguration.Value.Enable)
|
|
{
|
|
return Result(
|
|
HealthCheckStatus.Pass,
|
|
"Automated error reporting is enabled, thank you! To disable, edit the file appsettings.json or set the Bugsnag:Enable environment variable to false",
|
|
"Automated error reporting is enabled, thank you!")
|
|
.AsTask();
|
|
}
|
|
|
|
return InfoResult(
|
|
"Automated error reporting is disabled. Please enable to support bug fixing efforts!",
|
|
"Automated error reporting is disabled")
|
|
.AsTask();
|
|
}
|
|
}
|