Browse Source

Add Azure Storage Account Health Checks to Marketing.API

pull/235/head
dsanz 7 years ago
parent
commit
a8ad3edf30
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  2. +7
    -0
      src/Services/Marketing/Marketing.API/Startup.cs

+ 1
- 0
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -57,6 +57,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
</ItemGroup>


+ 7
- 0
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -66,6 +66,13 @@
services.AddHealthChecks(checks =>
{
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
var accountName = Configuration.GetValue<string>("AzureStorageAccountName");
var accountKey = Configuration.GetValue<string>("AzureStorageAccountKey");
if (!string.IsNullOrEmpty(accountName) && !string.IsNullOrEmpty(accountKey))
{
checks.AddAzureBlobStorageCheck(accountName, accountKey);
}
});
services.AddDbContext<MarketingContext>(options =>


Loading…
Cancel
Save