/ConfigurationDebugViewEndpoint

Add endpoint-enabled middleware by using IEndpointRouteBuilder extension method. https://nikiforovall.github.io/dotnet/aspnetcore/2021/03/23/endpoint-route-builder-extension-pattern.html

Primary LanguageC#MIT LicenseMIT

NikiforovAll.ConfigurationDebugViewEndpoint

GitHub Actions Status

GitHub Actions Build History

A convenient extension method(s) for IEndpointRouteBuilder to add configuration debug view.

The goal of this project is to provide a convenient way of adding something like this to a project:

Before:

app.UseEndpoints(endpoints =>
{
    endpoints.MapGet("/config", async context =>
    {
        var config = (Configuration as IConfigurationRoot).GetDebugView();
        await context.Response.WriteAsync(config);
    });
});

After:

app.UseEndpoints(endpoints =>
{
    endpoints.MapConfigurationDebugView("/config", (options) => options.AllowDevelopmentOnly = true);
});

For more examples, please see: tests