add healthcheck
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-06-08 16:48:27 +02:00
parent 10c1bb008f
commit 3bbc5c96f1
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
2 changed files with 3 additions and 0 deletions

View File

@ -21,6 +21,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />

View File

@ -48,6 +48,7 @@ namespace HanyadikHetVan
services.AddTransient<IEmailSender, EmailSender>(); services.AddTransient<IEmailSender, EmailSender>();
services.Configure<EmailSenderConfig>(Configuration.GetSection("EmailSender")); services.Configure<EmailSenderConfig>(Configuration.GetSection("EmailSender"));
services.AddDatabaseDeveloperPageExceptionFilter(); services.AddDatabaseDeveloperPageExceptionFilter();
services.AddHealthChecks().AddDbContextCheck<ApplicationDbContext>();
services.AddAuthentication(config => services.AddAuthentication(config =>
{ {
@ -168,6 +169,7 @@ namespace HanyadikHetVan
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapHealthChecks("/healthz");
endpoints.MapRazorPages(); endpoints.MapRazorPages();
endpoints.MapControllers(); endpoints.MapControllers();
}); });