Plex.Extensions.Configuration 8.0.9

dotnet add package Plex.Extensions.Configuration --version 8.0.9
                    
NuGet\Install-Package Plex.Extensions.Configuration -Version 8.0.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plex.Extensions.Configuration" Version="8.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plex.Extensions.Configuration" Version="8.0.9" />
                    
Directory.Packages.props
<PackageReference Include="Plex.Extensions.Configuration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plex.Extensions.Configuration --version 8.0.9
                    
#r "nuget: Plex.Extensions.Configuration, 8.0.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plex.Extensions.Configuration@8.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plex.Extensions.Configuration&version=8.0.9
                    
Install as a Cake Addin
#tool nuget:?package=Plex.Extensions.Configuration&version=8.0.9
                    
Install as a Cake Tool

Plex.Extensions.Configuration

A .NET 8 library that simplifies ASP.NET Core application configuration setup. Provides a single-call builder extension that loads JSON config files, integrates Azure Key Vault or Dapr secret store, expands environment variables in config values, and a multi-format configuration value resolver with caching.

Features

  • One-call startup configuration — loads appsettings.json + environment-specific overrides, clears default loggers, removes the Kestrel Server header
  • Azure Key Vault integration — automatically adds Key Vault as a configuration source when KV_NAME is set
  • Dapr secret store integration — bulk-fetches secrets from the Dapr sidecar when DAPR_SECRET_STORE is set
  • Environment variable expansion — resolves %VAR% placeholders in JSON config values at startup
  • Multi-format config resolver — searches secret-key, environment variable, colon-delimited, and raw key formats with in-memory caching

Installation

dotnet add package Plex.Extensions.Configuration

Usage

Application startup

var builder = WebApplication.CreateBuilder(args);

// Loads JSON configs, integrates secrets (Key Vault or Dapr), expands env vars
await builder.AddJsonConfigurationFilesAsync();

var app = builder.Build();

This single call handles:

  1. Clears default logging providers
  2. Removes the Kestrel Server response header (security hardening)
  3. Loads appsettings.json (with reload-on-change)
  4. Loads appsettings.{Environment}.json if it exists
  5. Integrates secrets from Azure Key Vault or Dapr (non-local environments only)
  6. Adds environment variables as a configuration source
  7. Expands %VAR% tokens in all JSON config values

Reading configuration values

// Basic usage — searches multiple key formats automatically
string value = configuration.GetConfigValue("MyKey");

// With a default fallback
string value = configuration.GetConfigValue("MyKey", defaultValue: "fallback");

// With a custom section name (default is "AppSetting")
string value = configuration.GetConfigValue("MyKey", settingName: "CustomSection");

GetConfigValue searches for the key in this priority order:

  1. In-memory cache (static ConcurrentDictionary)
  2. Secret key format — AppSetting-MyKey
  3. Environment variable — AppSetting__MyKey
  4. Colon-delimited — AppSetting:MyKey
  5. Pluralized section — AppSettings:MyKey
  6. Raw key — MyKey

Resolved values are cached for subsequent lookups and have %VAR% tokens expanded automatically.

Secret Store Configuration

Azure Key Vault

Set the KV_NAME environment variable to your Key Vault name. The library uses DefaultAzureCredential for authentication.

KV_NAME=my-keyvault-name

Dapr Secret Store

Set the DAPR_SECRET_STORE environment variable to the Dapr secret store component name. Secrets are bulk-fetched from the Dapr sidecar at startup.

DAPR_SECRET_STORE=my-secret-store

Key Vault and Dapr are mutually exclusive — if DAPR_SECRET_STORE is set, it takes precedence.

Local Development

Set IsLocal=true to skip secret store integration entirely (uses only JSON files and environment variables).

Environment Variable Expansion

Config values in appsettings.json can contain %VAR% placeholders:

{
  "ConnectionStrings": {
    "Default": "Server=%DB_HOST%;Database=%DB_NAME%;User=%DB_USER%;"
  }
}

These are expanded at startup using Environment.ExpandEnvironmentVariables(). Optionally, set ENV_VARIABLES to a comma-separated list to restrict which variables are expanded.

API Reference

Method Target Description
AddJsonConfigurationFilesAsync() WebApplicationBuilder Full startup configuration setup
GetConfigValue(key, defaultValue?, settingName?) IConfiguration Multi-format config key resolver with caching

Dependencies

Package Version
Azure.Extensions.AspNetCore.Configuration.Secrets 1.5.x
Azure.Identity 1.21.x

License

Plex-Solution Community Source-Available License — free for non-commercial use only.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Plex.Extensions.Configuration:

Package Downloads
Plex.DataAccess.Base

A .NET 8 library providing Unit of Work and Repository base classes for EF Core with multi-tenant dynamic connection strings, concurrency auto-resolution, bulk operations, raw SQL connection factories for Dapper, and JSON function mappings.

Plex.App.Insights.Core

A .NET 8 library that provides a single-call extension method to wire up OpenTelemetry-based Application Insights telemetry (traces and metrics) for ASP.NET Core applications with cloud role naming and SQL command capture support.

Plex.Extensions.DbContext

A .NET 8 library that simplifies EF Core DbContext registration with Microsoft Dependency Injection. Supports SQL Server and PostgreSQL, dynamic per-request connection strings (multi-tenant), optional cache interceptors, and raw SQL connection factories for Dapper.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.9 48 7/23/2026
8.0.7 218 7/2/2026
8.0.6 122 7/1/2026
8.0.3 2,857 7/2/2024
8.0.2 228 7/2/2024
8.0.1 460 7/2/2024
8.0.0 256 6/25/2024

Thread-safe configuration caching — Changed GetConfigValue to use ConcurrentDictionary with Lazy and GetOrAdd ensuring each configuration key value is resolved exactly once even under concurrent acces