Skip to content

Commit 518eec8

Browse files
Moving extensions from EndpointRouteBuilder
1 parent 537e621 commit 518eec8

3 files changed

Lines changed: 17 additions & 26 deletions

File tree

src/Dotnet6.GraphQL4.Store.WebAPI/Extensions/EndpointRouteBuilders/HealthChecksEndpointRouteBuilderExtensions.cs renamed to src/Dotnet6.GraphQL4.Store.WebAPI/DependencyInjection/Extensions/EndpointRouteBuilderExtensions.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
using Microsoft.AspNetCore.Builder;
55
using Microsoft.AspNetCore.Http;
66
using Microsoft.AspNetCore.Routing;
7+
using Microsoft.Extensions.Configuration;
78
using Microsoft.Extensions.Diagnostics.HealthChecks;
89

9-
namespace Dotnet6.GraphQL4.Store.WebAPI.Extensions.EndpointRouteBuilders
10+
namespace Dotnet6.GraphQL4.Store.WebAPI.DependencyInjection.Extensions
1011
{
11-
public static class HealthChecksEndpointRouteBuilderExtensions
12+
public static class EndpointRouteBuilderExtensions
1213
{
1314
private static readonly string[] ReadinessTags = {"ready"};
1415
private static readonly string[] LivenessTags = {"live"};
@@ -48,5 +49,17 @@ private static void MapHealthChecks(this IEndpointRouteBuilder endpoints, string
4849
[HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
4950
}
5051
});
52+
53+
public static void MapDumpConfig(this IEndpointRouteBuilder endpoints, string pattern, IConfigurationRoot configurationRoot, bool isProduction)
54+
{
55+
if (isProduction) return;
56+
57+
endpoints.MapGet(
58+
pattern: pattern,
59+
requestDelegate: context
60+
=> context.Response.WriteAsync(
61+
text: configurationRoot.GetDebugView(),
62+
cancellationToken: context.RequestAborted));
63+
}
5164
}
5265
}

src/Dotnet6.GraphQL4.Store.WebAPI/Extensions/EndpointRouteBuilders/ConfigurationsEndpointRouteBuilderExtensions.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Dotnet6.GraphQL4.Store.WebAPI/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Dotnet6.GraphQL4.CrossCutting.DependencyInjection.Extensions;
22
using Dotnet6.GraphQL4.Domain.Abstractions.DependencyInjection.Extensions;
3-
using Dotnet6.GraphQL4.Store.WebAPI.Extensions.EndpointRouteBuilders;
43
using Dotnet6.GraphQL4.Repositories.Abstractions.DependencyInjection.Extensions;
54
using Dotnet6.GraphQL4.Repositories.Abstractions.DependencyInjection.Options;
65
using Dotnet6.GraphQL4.Services.Abstractions.DependencyInjection.Extensions;
@@ -75,7 +74,8 @@ public void ConfigureServices(IServiceCollection services)
7574
services.AddHttpLogging(options
7675
=> options.LoggingFields = HttpLoggingFields.RequestProperties);
7776

78-
services.AddLogging()
77+
services
78+
.AddLogging()
7979
.AddBuilders()
8080
.AddRepositories()
8181
.AddUnitOfWork()

0 commit comments

Comments
 (0)