Workleap.Extensions.Configuration.Substitution
1.1.3-preview.22
Prefix Reserved
See the version list below for details.
dotnet add package Workleap.Extensions.Configuration.Substitution --version 1.1.3-preview.22
NuGet\Install-Package Workleap.Extensions.Configuration.Substitution -Version 1.1.3-preview.22
<PackageReference Include="Workleap.Extensions.Configuration.Substitution" Version="1.1.3-preview.22" />
<PackageVersion Include="Workleap.Extensions.Configuration.Substitution" Version="1.1.3-preview.22" />
<PackageReference Include="Workleap.Extensions.Configuration.Substitution" />
paket add Workleap.Extensions.Configuration.Substitution --version 1.1.3-preview.22
#r "nuget: Workleap.Extensions.Configuration.Substitution, 1.1.3-preview.22"
#:package Workleap.Extensions.Configuration.Substitution@1.1.3-preview.22
#addin nuget:?package=Workleap.Extensions.Configuration.Substitution&version=1.1.3-preview.22&prerelease
#tool nuget:?package=Workleap.Extensions.Configuration.Substitution&version=1.1.3-preview.22&prerelease
Workleap.Extensions.Configuration.Substitution
This package adds variable substitution configuration provider implementation for Microsoft.Extensions.Configuration.
Getting started
dotnet add package Workleap.Extensions.Configuration.Substitution
// Example for an ASP.NET Core web application
var builder = WebApplication.CreateBuilder(args);
// Setup your configuration
builder.Configuration.AddJsonFile("appsettings.json");
builder.Configuration.AddEnvironmentVariables();
builder.Configuration.AddSubstitution(); // <-- Add this after other configuration providers
How it works
You can reference configuration values inside other configuration values by enclosing the referenced configuration key like this: ${ReferencedConfigurationKey}.
Examples
Consider this appsettings.json:
{
"Credentials": {
"Username": "alice1",
"Password": "P@ssw0rd"
},
"ConnectionString": "usr=${Credentials:Username};pwd=${Credentials:Password}"
}
Evaluating the configuration value ConnectionString would return usr=alice1;pwd=P@ssw0rd.
This also works if you're using multiple configuration providers. For instance, one could have the Credentials:Password configuration value provided by a secret from Azure Key Vault and this value would have been injected into the ConnectionString value too.
It also works with arrays:
{
"Credentials": [ "alice1", "P@ssw0rd" ],
"ConnectionString": "usr=${Credentials:0};pwd=${Credentials:1}"
}
Again, you're not limited to JSON file providers, you could use substitution with any configuration providers. It was easier to use JSON files in these examples.
Escaping values
You might not want a specific value to be substituted. In that case, escape it using double curly braces:
{
"Foo": "foo",
"Bar": "${{Foo}}"
}
Evaluating the configuration value Bar would return ${Foo}.
Exceptions
You can encounter two kinds of exceptions if your configuration is incorrect:
UnresolvedConfigurationKeyException, if you're trying to substitute a configuration value that is undefined (i.e. the key does not exist).RecursiveConfigurationKeyException, if you have many configuration values that reference each other in a recursive manner, no matter how deep the recursion is. The exception will give you details about the recursive path.
UnresolvedConfigurationKeyException can also be triggered sooner than later by using AddSubstitution(eagerValidation: true). Using eagerValidation with value true (default is false) instructs the library to check for undefined values in all the existing configuration values once, instead of checking for a particular value. This happens as soon as any configuration value is loaded.
Configuration providers order
When using .NET's IConfigurationBuilder, the order of configuration providers matters . Any configuration provider added after AddSubstitution() would not benefit from the substitution process.
License
Copyright © 2022, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/gsoft-inc/gsoft-license/blob/master/LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.15-preview.2 | 28 | 10/21/2025 |
| 1.2.15-preview.1 | 34 | 10/20/2025 |
| 1.2.14 | 659 | 10/19/2025 |
| 1.2.14-preview.3 | 33 | 10/18/2025 |
| 1.2.14-preview.2 | 94 | 10/17/2025 |
| 1.2.14-preview.1 | 119 | 10/13/2025 |
| 1.2.13 | 1,474 | 10/12/2025 |
| 1.2.13-preview.2 | 117 | 10/7/2025 |
| 1.2.13-preview.1 | 117 | 10/6/2025 |
| 1.2.12 | 2,108 | 10/5/2025 |
| 1.2.12-preview.2 | 106 | 10/3/2025 |
| 1.2.12-preview.1 | 114 | 9/29/2025 |
| 1.2.11 | 1,704 | 9/28/2025 |
| 1.2.11-preview.1 | 126 | 9/23/2025 |
| 1.2.10 | 1,095 | 9/21/2025 |
| 1.2.10-preview.3 | 172 | 9/19/2025 |
| 1.2.10-preview.2 | 242 | 9/17/2025 |
| 1.2.10-preview.1 | 239 | 9/17/2025 |
| 1.2.9 | 1,671 | 9/14/2025 |
| 1.2.9-preview.2 | 102 | 9/14/2025 |
| 1.2.9-preview.1 | 112 | 9/12/2025 |
| 1.2.8 | 1,326 | 9/7/2025 |
| 1.2.8-preview.2 | 126 | 9/2/2025 |
| 1.2.8-preview.1 | 127 | 9/1/2025 |
| 1.2.7 | 1,288 | 8/31/2025 |
| 1.2.7-preview.3 | 169 | 8/27/2025 |
| 1.2.7-preview.2 | 168 | 8/26/2025 |
| 1.2.7-preview.1 | 142 | 8/25/2025 |
| 1.2.6 | 1,733 | 8/24/2025 |
| 1.2.6-preview.2 | 75 | 8/22/2025 |
| 1.2.6-preview.1 | 117 | 8/19/2025 |
| 1.2.5 | 1,850 | 8/17/2025 |
| 1.2.5-preview.1 | 125 | 8/12/2025 |
| 1.2.4 | 1,420 | 8/10/2025 |
| 1.2.4-preview.3 | 105 | 8/9/2025 |
| 1.2.4-preview.2 | 153 | 8/8/2025 |
| 1.2.4-preview.1 | 189 | 8/5/2025 |
| 1.2.3 | 4,262 | 7/30/2025 |
| 1.2.3-preview.2 | 102 | 7/30/2025 |
| 1.2.3-preview.1 | 103 | 7/29/2025 |
| 1.2.2 | 1,068 | 7/27/2025 |
| 1.2.2-preview.5 | 514 | 7/22/2025 |
| 1.2.2-preview.4 | 511 | 7/22/2025 |
| 1.2.2-preview.3 | 504 | 7/22/2025 |
| 1.2.2-preview.2 | 466 | 7/21/2025 |
| 1.2.2-preview.1 | 298 | 7/21/2025 |
| 1.2.1 | 1,442 | 7/20/2025 |
| 1.2.1-preview.2 | 118 | 7/17/2025 |
| 1.2.1-preview.1 | 116 | 7/16/2025 |
| 1.2.0 | 3,194 | 7/14/2025 |
| 1.1.20-preview.1 | 119 | 7/14/2025 |
| 1.1.19 | 1,206 | 7/13/2025 |
| 1.1.19-preview.4 | 44 | 7/12/2025 |
| 1.1.19-preview.3 | 122 | 7/10/2025 |
| 1.1.19-preview.2 | 125 | 7/10/2025 |
| 1.1.19-preview.1 | 138 | 7/8/2025 |
| 1.1.18 | 1,585 | 7/6/2025 |
| 1.1.18-preview.2 | 114 | 7/4/2025 |
| 1.1.18-preview.1 | 128 | 7/1/2025 |
| 1.1.17 | 4,685 | 6/29/2025 |
| 1.1.17-preview.2 | 122 | 6/18/2025 |
| 1.1.16 | 2,738 | 6/15/2025 |
| 1.1.16-preview.2 | 124 | 6/14/2025 |
| 1.1.16-preview.1 | 480 | 6/10/2025 |
| 1.1.15 | 2,124 | 6/8/2025 |
| 1.1.15-preview.2 | 96 | 6/8/2025 |
| 1.1.15-preview.1 | 124 | 6/3/2025 |
| 1.1.14 | 2,359 | 6/1/2025 |
| 1.1.14-preview.1 | 130 | 5/26/2025 |
| 1.1.13 | 872 | 5/25/2025 |
| 1.1.13-preview.3 | 103 | 5/25/2025 |
| 1.1.13-preview.2 | 87 | 5/23/2025 |
| 1.1.13-preview.1 | 126 | 5/20/2025 |
| 1.1.12 | 495 | 5/18/2025 |
| 1.1.12-preview.2 | 135 | 5/17/2025 |
| 1.1.12-preview.1 | 221 | 5/13/2025 |
| 1.1.11 | 3,731 | 5/11/2025 |
| 1.1.11-preview.1 | 127 | 5/6/2025 |
| 1.1.10 | 1,138 | 5/4/2025 |
| 1.1.10-preview.1 | 139 | 4/29/2025 |
| 1.1.9 | 364 | 4/27/2025 |
| 1.1.9-preview.2 | 124 | 4/25/2025 |
| 1.1.9-preview.1 | 135 | 4/22/2025 |
| 1.1.8-preview.1 | 2,064 | 4/14/2025 |
| 1.1.7-preview.1 | 97 | 4/11/2025 |
| 1.1.6-preview.3 | 144 | 4/7/2025 |
| 1.1.6-preview.2 | 144 | 4/1/2025 |
| 1.1.6-preview.1 | 140 | 4/1/2025 |
| 1.1.5 | 13,709 | 3/20/2025 |
| 1.1.5-preview.13 | 140 | 3/20/2025 |
| 1.1.5-preview.12 | 135 | 3/20/2025 |
| 1.1.5-preview.11 | 154 | 3/20/2025 |
| 1.1.5-preview.10 | 138 | 3/20/2025 |
| 1.1.5-preview.9 | 62 | 3/15/2025 |
| 1.1.5-preview.8 | 147 | 3/11/2025 |
| 1.1.5-preview.7 | 98 | 2/18/2025 |
| 1.1.5-preview.6 | 90 | 2/17/2025 |
| 1.1.5-preview.5 | 85 | 2/16/2025 |
| 1.1.5-preview.4 | 88 | 2/15/2025 |
| 1.1.5-preview.3 | 87 | 2/12/2025 |
| 1.1.5-preview.2 | 86 | 1/30/2025 |
| 1.1.5-preview.1 | 87 | 1/24/2025 |
| 1.1.4 | 40,981 | 1/21/2025 |
| 1.1.4-preview.16 | 101 | 1/17/2025 |
| 1.1.4-preview.15 | 77 | 1/13/2025 |
| 1.1.4-preview.13 | 90 | 12/18/2024 |
| 1.1.4-preview.12 | 535 | 11/29/2024 |
| 1.1.4-preview.11 | 91 | 11/24/2024 |
| 1.1.4-preview.10 | 77 | 11/16/2024 |
| 1.1.4-preview.9 | 83 | 10/31/2024 |
| 1.1.4-preview.8 | 82 | 10/30/2024 |
| 1.1.4-preview.7 | 85 | 10/28/2024 |
| 1.1.4-preview.6 | 84 | 10/28/2024 |
| 1.1.4-preview.5 | 83 | 10/28/2024 |
| 1.1.4-preview.4 | 81 | 10/7/2024 |
| 1.1.4-preview.3 | 87 | 10/1/2024 |
| 1.1.4-preview.2 | 84 | 9/30/2024 |
| 1.1.4-preview.1 | 91 | 9/27/2024 |
| 1.1.3 | 53,206 | 9/23/2024 |
| 1.1.3-preview.48 | 92 | 9/20/2024 |
| 1.1.3-preview.47 | 87 | 9/13/2024 |
| 1.1.3-preview.46 | 85 | 8/27/2024 |
| 1.1.3-preview.45 | 83 | 8/27/2024 |
| 1.1.3-preview.44 | 84 | 8/27/2024 |
| 1.1.3-preview.43 | 84 | 8/27/2024 |
| 1.1.3-preview.42 | 101 | 8/16/2024 |
| 1.1.3-preview.41 | 84 | 7/30/2024 |
| 1.1.3-preview.40 | 126 | 7/18/2024 |
| 1.1.3-preview.39 | 90 | 7/18/2024 |
| 1.1.3-preview.38 | 82 | 7/5/2024 |
| 1.1.3-preview.37 | 88 | 5/31/2024 |
| 1.1.3-preview.36 | 110 | 5/31/2024 |
| 1.1.3-preview.35 | 86 | 5/21/2024 |
| 1.1.3-preview.34 | 99 | 5/10/2024 |
| 1.1.3-preview.33 | 86 | 5/3/2024 |
| 1.1.3-preview.32 | 154 | 4/15/2024 |
| 1.1.3-preview.31 | 104 | 4/12/2024 |
| 1.1.3-preview.30 | 124 | 4/3/2024 |
| 1.1.3-preview.29 | 101 | 4/3/2024 |
| 1.1.3-preview.28 | 119 | 3/8/2024 |
| 1.1.3-preview.27 | 110 | 3/7/2024 |
| 1.1.3-preview.26 | 98 | 3/4/2024 |
| 1.1.3-preview.25 | 103 | 3/1/2024 |
| 1.1.3-preview.24 | 103 | 2/16/2024 |
| 1.1.3-preview.23 | 95 | 2/12/2024 |
| 1.1.3-preview.22 | 110 | 2/6/2024 |
| 1.1.3-preview.21 | 97 | 2/6/2024 |
| 1.1.3-preview.20 | 109 | 1/22/2024 |
| 1.1.3-preview.19 | 96 | 1/12/2024 |
| 1.1.3-preview.18 | 89 | 1/12/2024 |
| 1.1.3-preview.17 | 89 | 1/12/2024 |
| 1.1.3-preview.16 | 110 | 12/18/2023 |
| 1.1.3-preview.15 | 126 | 11/26/2023 |
| 1.1.3-preview.14 | 113 | 11/17/2023 |
| 1.1.3-preview.13 | 99 | 11/13/2023 |
| 1.1.3-preview.12 | 200 | 11/6/2023 |
| 1.1.3-preview.11 | 117 | 10/30/2023 |
| 1.1.3-preview.10 | 116 | 10/20/2023 |
| 1.1.3-preview.9 | 121 | 10/17/2023 |
| 1.1.3-preview.8 | 142 | 10/13/2023 |
| 1.1.3-preview.7 | 116 | 9/26/2023 |
| 1.1.3-preview.6 | 112 | 9/25/2023 |
| 1.1.3-preview.5 | 107 | 9/21/2023 |
| 1.1.3-preview.4 | 107 | 9/20/2023 |
| 1.1.3-preview.3 | 115 | 9/20/2023 |
| 1.1.3-preview.2 | 141 | 9/20/2023 |
| 1.1.3-preview.1 | 147 | 8/9/2023 |
| 1.1.2 | 139,529 | 7/20/2023 |
| 1.1.2-preview.20 | 171 | 7/20/2023 |