Skip to content

NikiforovAll/ConfigurationDebugViewEndpoint

Repository files navigation

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