mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-06-30 18:42:56 +00:00
feat: Add health check for rabbitmq
This commit is contained in:
parent
f44d36af02
commit
8ed703a865
@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.ApplicationStatus" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="7.1.0" />
|
||||
|
@ -30,10 +30,18 @@ builder.Services
|
||||
|
||||
if (builder.Environment.IsProduction())
|
||||
{
|
||||
var rabbitMqConfig = builder.Configuration.GetSection("RabbitMQ");
|
||||
|
||||
// Todo: Check if this works
|
||||
var host = rabbitMqConfig["Host"]!;
|
||||
var username = rabbitMqConfig["Username"]!;
|
||||
var password = rabbitMqConfig["Password"]!;
|
||||
|
||||
builder.Services
|
||||
.AddHealthChecks()
|
||||
.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!)
|
||||
.AddRedis(builder.Configuration["RedisHostName"]!, "Redis");
|
||||
.AddRedis(builder.Configuration["RedisHostName"]!, "Redis")
|
||||
.AddRabbitMQ($"amqp://{username}:{password}@{host}:5672", null, "RabbitMQ");
|
||||
}
|
||||
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
|
Loading…
Reference in New Issue
Block a user