Skip to content

aforloney/config-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

config-view

Publish Packages

Purpose

An extension method for iterating and viewing the contents of your configuration as an endpoint.

This was inspired off of an extenstion method on IConfigurationRoot exposed to debug view the pieced together configuration values for the application across all possible configured providers.

However, the extension method returned all of the contents as a string and required manual work to expose the contents behind an endpoint. This aims to workaorund that and provide the ability to specify configuration provider to view (e.g, JSON settings, memory, environment variables, etc).

Usage

The purpose of the repository was to easily and quickly view the contents of your configuration with as little lines of code as possible. Currently, you can register either viewing all confgiuration provider types or JSON specific through extension methods. See below for more information:

ASP.NET Core 5

if (app.Environment.IsDevelopment())
{
    app.AddConfigEndpoint();
    ...
}

ASP.NET Core 6

if (app.Environment.IsDevelopment())
{
    app.AddConfigEndpoint(builder); // where Builder is of WebApplicationBuilder
    ...
}

And then register the appropriate type of configuration you wish to view,

// for all type of providers,
services.AddConfigEndpoint();
// or JSON only,
services.AddJsonConfigEndpoint();
// or Environment Variables only,
services.AddEnvironmentConfigEndpoint();
// or Memory Configuration only,
services.AddMemoryConfigEndpoint();

Once added, the application will expose a new GET endpoint called /config to display the contents of the specific configuration provider that was used earlier when registering the service.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages