mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 18:37:18 +02:00
chore: added healthchecks
This commit is contained in:
1 parent
bf1dcad5dc
commit
f2f0b4e195
4 files changed
+35
-3
No files matched your search
@@ -1,7 +1,9 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using WotBlitzStatisticsPro.Common;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
using WotBlitzStatisticsPro.GraphQl.Mutation;
|
||||
@@ -33,9 +35,12 @@ namespace WotBlitzStatisticsPro.GraphQl
|
||||
services.AddSingleton<IMongoSettings>(mongoConfig);
|
||||
WotBlitzStatisticsLogicInstaller.ConfigureServices(services);
|
||||
|
||||
services.AddHealthChecks()
|
||||
.AddCheck("self", () => HealthCheckResult.Healthy())
|
||||
.AddMongoDb(mongoConfig.ConnectionString, tags: new[] { "services" });
|
||||
|
||||
// Add GraphQL Services
|
||||
services.AddGraphQLServer()
|
||||
services.AddGraphQLServer()
|
||||
.AddQueryType<WotBlitzStatisticsQuery>()
|
||||
.AddMutationType<WotBlitzStatisticsMutation>()
|
||||
.AddType<AccountsSearchItemObjectType>()
|
||||
@@ -53,7 +58,15 @@ namespace WotBlitzStatisticsPro.GraphQl
|
||||
.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapGraphQL();
|
||||
});
|
||||
endpoints.MapHealthChecks("/health/self", new HealthCheckOptions
|
||||
{
|
||||
Predicate = r => r.Tags.Contains("self")
|
||||
});
|
||||
endpoints.MapHealthChecks("/health/startup", new HealthCheckOptions
|
||||
{
|
||||
Predicate = r => r.Tags.Contains("services")
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="5.0.1" />
|
||||
<PackageReference Include="HotChocolate.AspNetCore" Version="11.0.6" />
|
||||
<PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="11.0.6" />
|
||||
<PackageReference Include="HotChocolate.Types.Filters" Version="11.0.6" />
|
||||
|
||||
Reference in new issue
Block a user