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
<PackageReference Include="Plex.Extensions.Configuration" Version="8.0.9" />
<PackageVersion Include="Plex.Extensions.Configuration" Version="8.0.9" />
<PackageReference Include="Plex.Extensions.Configuration" />
paket add Plex.Extensions.Configuration --version 8.0.9
#r "nuget: Plex.Extensions.Configuration, 8.0.9"
#:package Plex.Extensions.Configuration@8.0.9
#addin nuget:?package=Plex.Extensions.Configuration&version=8.0.9
#tool nuget:?package=Plex.Extensions.Configuration&version=8.0.9
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 KestrelServerheader - Azure Key Vault integration — automatically adds Key Vault as a configuration source when
KV_NAMEis set - Dapr secret store integration — bulk-fetches secrets from the Dapr sidecar when
DAPR_SECRET_STOREis 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:
- Clears default logging providers
- Removes the Kestrel
Serverresponse header (security hardening) - Loads
appsettings.json(with reload-on-change) - Loads
appsettings.{Environment}.jsonif it exists - Integrates secrets from Azure Key Vault or Dapr (non-local environments only)
- Adds environment variables as a configuration source
- 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:
- In-memory cache (static
ConcurrentDictionary) - Secret key format —
AppSetting-MyKey - Environment variable —
AppSetting__MyKey - Colon-delimited —
AppSetting:MyKey - Pluralized section —
AppSettings:MyKey - 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_STOREis 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 | Versions 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. |
-
net8.0
- Azure.Extensions.AspNetCore.Configuration.Secrets (>= 1.5.1)
- Azure.Identity (>= 1.21.0)
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.
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