0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-29 18:21:08 +00:00

feat: Try out Zen firewall

This commit is contained in:
alex289 2025-02-27 19:48:05 +01:00
parent 0234b28214
commit b4ba65c5b3
No known key found for this signature in database
GPG Key ID: 573F77CD2D87F863
3 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aikido.Zen.DotNetCore" Version="1.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.ApplicationStatus" Version="9.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="9.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="9.0.0" />

View File

@ -1,4 +1,5 @@
using System;
using Aikido.Zen.DotNetCore;
using CleanArchitecture.Api.BackgroundServices;
using CleanArchitecture.Api.Extensions;
using CleanArchitecture.Application.Extensions;
@ -27,6 +28,11 @@ builder.Services.AddGrpc();
builder.Services.AddGrpcReflection();
builder.Services.AddEndpointsApiExplorer();
if (builder.Environment.IsProduction())
{
builder.Services.AddZenFirewall();
}
builder.Services
.AddHealthChecks()
.AddDbContextCheck<ApplicationDbContext>()
@ -129,6 +135,11 @@ app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
if (builder.Environment.IsProduction())
{
app.UseZenFirewall();
}
app.MapHealthChecks("/healthz", new HealthCheckOptions
{
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse

View File

@ -21,5 +21,8 @@
"Username": "admin",
"Password": "DOIA9234JF",
"Enabled": "True"
},
"Aikido": {
"AikidoToken": ""
}
}