mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-07-01 19:12:57 +00:00
feat: Improve rabbit health check
This commit is contained in:
parent
b355aeb8ff
commit
9f9707ddf1
@ -29,18 +29,17 @@ builder.Services
|
|||||||
|
|
||||||
if (builder.Environment.IsProduction())
|
if (builder.Environment.IsProduction())
|
||||||
{
|
{
|
||||||
var rabbitMqConfig = builder.Configuration.GetSection("RabbitMQ");
|
var rabbitHost = builder.Configuration["RabbitMQ:Host"];
|
||||||
|
var rabbitUser = builder.Configuration["RabbitMQ:Username"];
|
||||||
// Todo: Check if this works
|
var rabbitPass = builder.Configuration["RabbitMQ:Password"];
|
||||||
var host = rabbitMqConfig["Host"]!;
|
|
||||||
var username = rabbitMqConfig["Username"]!;
|
|
||||||
var password = rabbitMqConfig["Password"]!;
|
|
||||||
|
|
||||||
builder.Services
|
builder.Services
|
||||||
.AddHealthChecks()
|
.AddHealthChecks()
|
||||||
.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!)
|
.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!)
|
||||||
.AddRedis(builder.Configuration["RedisHostName"]!, "Redis")
|
.AddRedis(builder.Configuration["RedisHostName"]!, "Redis")
|
||||||
.AddRabbitMQ($"amqp://{username}:{password}@{host}:5672", null, "RabbitMQ");
|
.AddRabbitMQ(
|
||||||
|
rabbitConnectionString: $"amqp://{rabbitUser}:{rabbitPass}@{rabbitHost}",
|
||||||
|
name: "RabbitMQ");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
|
Loading…
Reference in New Issue
Block a user