Skip to content

Commit a8ad3ed

Browse files
committed
Add Azure Storage Account Health Checks to Marketing.API
1 parent b74a1b6 commit a8ad3ed

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/Services/Marketing/Marketing.API/Marketing.API.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<ItemGroup>
5858
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
5959
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
60+
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj" />
6061
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
6162
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
6263
</ItemGroup>

src/Services/Marketing/Marketing.API/Startup.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
6666
services.AddHealthChecks(checks =>
6767
{
6868
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
69+
70+
var accountName = Configuration.GetValue<string>("AzureStorageAccountName");
71+
var accountKey = Configuration.GetValue<string>("AzureStorageAccountKey");
72+
if (!string.IsNullOrEmpty(accountName) && !string.IsNullOrEmpty(accountKey))
73+
{
74+
checks.AddAzureBlobStorageCheck(accountName, accountKey);
75+
}
6976
});
7077

7178
services.AddDbContext<MarketingContext>(options =>

0 commit comments

Comments
 (0)