Skip to content

Commit

Permalink
Db health contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
macsux committed Oct 14, 2021
1 parent 75ca15f commit 03c41aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ void DoAddMigration()
DotNet($"ef migrations add {MigrationName} --project src/{TargetProject}", environmentVariables: environmentVariables);
}
Target GetVersion => _ => _
.Description("Returns current project semver based on current branch")
.Executes(() =>
{
Logger.Block(GitVersion.NuGetPackageVersion);
});
Target PrepareRelease => _ => _
.Description("Cuts a stabilization branch and increments version number of development branch")
.Executes(() =>
{
NerdbankGitVersioningPrepareRelease(x => x.SetTag("beta"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<!--#endif -->
<!--#if mysql -->
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
<PackageReference Include="Steeltoe.Connector.ConnectorCore" Version="3.1.1" />
<PackageReference Include="Steeltoe.Connector.EFCore" Version="3.1.1" />
<!--#endif -->
<!--#if configserver -->
Expand Down
8 changes: 7 additions & 1 deletion src/MyProjectGroup.DotnetAccelerator/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Data;
using idunno.Authentication.Basic;
using MediatR;

Expand All @@ -16,9 +17,12 @@
using MyProjectGroup.Common.Persistence;
using MyProjectGroup.Common.Security;
using MyProjectGroup.DotnetAccelerator.Persistence;
using Steeltoe.Common.HealthChecks;
using Steeltoe.Connector;
using Steeltoe.Extensions.Logging;
using Steeltoe.Management.Endpoint;
using Steeltoe.Management.Tracing;
using DbType = MyProjectGroup.Common.Persistence.DbType;
#if enableSecurity
using Microsoft.AspNetCore.Authentication.JwtBearer;
#endif
Expand Down Expand Up @@ -97,7 +101,9 @@ public void ConfigureServices(IServiceCollection services)
#endif
}
});
services.AddControllers(cfg => cfg.Filters.Add<DomainExceptionFilter>());
services.AddScoped<IDbConnection>(ctx => ctx.GetRequiredService<DotnetAcceleratorContext>().Database.GetDbConnection());
services.AddScoped<IHealthContributor, RelationalDbHealthContributor>(); // allow db connection health to show up in actuator health endpoint
services.AddControllers(cfg => cfg.Filters.Add<DomainExceptionFilter>()); // respond with HTTP400 if domain exception is thrown
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo {Title = "MyProjectGroup.DotnetAccelerator", Version = "v1"}); });
}

Expand Down

0 comments on commit 03c41aa

Please sign in to comment.