Skip to content

burnchar/configuration-extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

configuration-extensions

Extensions to IConfiguration, such as visualizers to help understand and debug your program configuration.

usage

  • Add ConfigurationExtensions.cs and ConfigurationVisualizer.cs to your project.
  • Change the namespace to suit your program.
  • Call the .Visualize() or .VisualizeSimple() extension on your configuration:
var builder = Host.CreateApplicationBuilder(args);
var config = app.Services.GetRequiredService<IConfiguration>();
var app = builder.Build();

// Graphical representation using unicode icons
Console.WriteLine(config.Visualize());

// ASCII (no icons) visualization for basic terminals
Console.WriteLine(config.VisualizeSimple());

// Add "excludeVendorSections: false" to show everything (some noise is excluded by default)
Console.WriteLine(config.Visualize(excludeVendorSections: false));

// Add "excludeVendorSections: false" to show everything (some noise is excluded by default)
Console.WriteLine(config.Visualize(excludeVendorSections: false));

// Ignore keys starting with specific strings (overrides default ignores)
var ignorePaths = new List<string> { "ConnectionStrings", "contentRoot" };
Console.WriteLine(config.Visualize(ignorePaths));

Example visualization (dark theme console)

image

About

Extensions to IConfiguration, such as visualizers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages