You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Version 2 is here with some new features:
24
24
## Key/Value Config Builders
25
25
26
26
If you read the blog post linked above, you probably recognize that Configuration Builders can be quite flexible. Applications can use the Configuration Builder
27
-
concept to construct incredibly complex configuration on the fly. But for the most common usage scenarios, a simple key/value replacement mechanism is all that
27
+
concept to construct incredibly complex configuration on the fly. But for the most common usage scenarios, a basic key/value replacement mechanism is all that
28
28
is needed. Most of the config builders in this project are such key/value builders.
29
29
30
30
#### mode
@@ -36,13 +36,13 @@ set to run in three different modes:
36
36
external source.
37
37
*`Greedy` - This mode is closely related to `Strict` mode, but instead of being limited to keys that already exist in the original configuration, the config builders
38
38
will dump all key/value pairs from the external source into the resulting config section.
39
-
*`Expand` - This last mode operates on the raw xml before it gets parsed into a config section object. It can be thought of as a simple expansion of tokens in a
39
+
*`Expand` - This last mode operates on the raw xml before it gets parsed into a config section object. It can be thought of as a basic expansion of tokens in a
40
40
string. Any part of the raw xml string that matches the pattern __`${token}`__ is a candidate for token expansion. If no corresponding value is found in the
41
41
external source, then the token is left alone.
42
42
43
43
#### prefix
44
44
Another feature of these key/value Configuration Builders is prefix handling. Because full-framework .Net configuration is complex and nested, and external key/value
45
-
sources are by nature quite simple and flat, leveraging key prefixes can be useful. For example, if you want to inject both App Settings and Connection Strings into
45
+
sources are by nature quite basic and flat, leveraging key prefixes can be useful. For example, if you want to inject both App Settings and Connection Strings into
46
46
your configuration via environment variables, you could accomplish this in two ways. Use the `EnvironmentConfigBuilder` in the default `Strict` mode and make sure you
47
47
have the appropriate key names already coded into your config file. __OR__ you could use two `EnvironmentConfigBuilder`s in `Greedy` mode with distinct prefixes
48
48
so they can slurp up any setting or connection string you provide without needing to update the raw config file in advance. Like this:
@@ -63,10 +63,10 @@ This way the same flat key/value source can be used to populate configuration fo
63
63
#### stripPrefix
64
64
A related setting that is common among all of these key/value builders is `stripPrefix`. The code above does a good job of separating app settings from connection
65
65
strings... but now all the keys in AppSettings start with "AppSetting_". Maybe this is fine for code you wrote. Chances are that prefix is better off stripped from the
66
-
key name before being inserted into AppSettings. `stripPrefix` is a simple boolean value, and accomplishes just that. It's default value is `false`.
66
+
key name before being inserted into AppSettings. `stripPrefix` is a boolean value, and accomplishes just that. It's default value is `false`.
67
67
68
68
#### optional
69
-
This setting is a simple boolean that specified whether to avoid throwing exceptions when the backing configuration source cannot be found or connected.
69
+
This setting is a boolean that specified whether to avoid throwing exceptions when the backing configuration source cannot be found or connected.
70
70
The default default value is `true`, though some config builders (such as the Azure-based builders) will use a different default.
71
71
72
72
#### tokenPattern
@@ -75,7 +75,7 @@ above, it was mentioned that the raw xml is searched for tokens that look like _
75
75
The set of characters that matches `\w` is more strict than xml and many sources of config values allow, and some applications may need to allow more exotic characters
76
76
in their token names. Additionally there might be scenarios where the `${}` pattern is not acceptable.
77
77
78
-
`tokenPattern` allows developers to change the regex that is used for token matching. It is a simple string argument, and no validation is done to make sure it is
78
+
`tokenPattern` allows developers to change the regex that is used for token matching. It is a string argument, and no validation is done to make sure it is
79
79
a well-formed non-dangerous regex - so use it wisely. The only real restriction is that is must contain a capture group. The entire regex must match the entire token,
80
80
and the first capture must be the token name to look up in the config source.
This is the simplest of the config builders. It draws its values from Environment, and it does not have any additional configuration options.
125
+
This is the most basic of the config builders. It draws its values from Environment, and it does not have any additional configuration options.
126
126
*__NOTE:__ In a Windows container environment, variables set at run time are only injected into the EntryPoint process environment.
127
127
Applications that run as a service or a non-EntryPoint process will not pick up these variables unless they are otherwise injected through
128
128
some mechanism in the container. For [IIS](https://github.com/Microsoft/iis-docker/pull/41)/[ASP.Net](https://github.com/Microsoft/aspnet-docker)-based
This is a simple config builder that uses a directory's files as a source of values. A file's name is the key, and the contents are the value. This
258
+
This config builder uses a directory's files as a source of values. A file's name is the key, and the contents are the value. This
259
259
config builder can be useful when running in an orchestrated container environment, as systems like Docker Swarm and Kubernetes provide 'secrets' to
260
260
their orchestrated windows containers in this key-per-file manner.
261
261
*`directoryPath` - This is a required attribute. It specifies a path to the source directory to look in for values. Docker for Windows secrets
@@ -275,7 +275,7 @@ their orchestrated windows containers in this key-per-file manner.
275
275
Because .Net Core projects can rely heavily on json files for configuration, it makes some sense to allow those same files to be used in full-framework
276
276
configuration as well. You can imagine that the heirarchical nature of json might enable some fantastic capabilities for building complex configuration sections.
277
277
But this config builders is meant to be a simple mapping from a flat key/value source into specific key/value areas of full-framework configuration. Thus its name
278
-
begins with 'Simple.' Think of the backing json file as a simple dictionary, rather than a comlex heirarchical object.
278
+
begins with 'Simple.' Think of the backing json file as a basic dictionary, rather than a comlex heirarchical object.
279
279
280
280
(A multi-level heirarchical file can be used. This provider will simply 'flatten' the depth by appending the property name at each level using ':' as a delimiter.)
281
281
@@ -345,7 +345,7 @@ When adding additional handlers, the name of the section must be 'Microsoft.Conf
345
345
346
346
If you don't see a config builder here that suits your needs, you can write your own. Referencing the `Basic` nuget package for this project will get you the base upon which
347
347
all of these builders inherit. Most of the heavy-ish lifting and consistent behavior across key/value config builders comes from this base. Take a look at the code for more
348
-
detail, but in many cases implementing a custom key/value config builder in this same vein is as simple as inheriting the base, and implementing two simple methods.
348
+
detail, but in many cases implementing a custom key/value config builder in this same vein is as easy as inheriting the base, and implementing two basic methods.
<addkey="WINDIR"value="Will be replaced by 'Environment' in Strict and Greedy modes." />
41
41
<addkey="SYSTEMDRIVE"value="Will initally be replaced by 'Environment' in Strict and Greedy modes... but then superceded by 'Secrets' in the same modes." />
<addkey="ARCHITECTURE"value="Will be replaced by 'Environment' in Strict/Greedy modes IFF prefix='PROCESSOR_' AND stripPrefix='true'" />
44
44
<addkey="PROCESSOR_ARCHITECTURE"value="Will be left untouched by 'Environment' in Strict/Greedy modes if IFF prefix='PROCESSOR_' AND stripPrefix='true'" />
45
-
<addkey="jsonSetting1"value="Will be replaced by 'SimpleJson' in Strict and Greedy modes." />
<addkey="appSettings:jsonSubSetting2"value="Will be replaced by 'Json' in Strict and Greedy modes." />
48
+
<addkey="jsonSubSetting2"value="Will be replaced by 'Json' in 'Sectional' jsonMode." />
49
+
<addkey="jsonSub:subSetting3"value="Will be replaced by 'Json' in 'Sectional' jsonMode." />
50
+
<addkey="jsonConnectionString1"value="WILL be replaced by 'Json' in 'Flat' jsonMode." />
51
+
<addkey="jsonConnectionString2"value="WILL NOT be replaced by 'Json' in 'Sectional' jsonMode." />
52
+
<addkey="jsonCustomSetting1"value="Will be replaced by 'Json' with prefix='customSettings:' and stripPrefix='true'." />
53
53
<addkey="SecretFromFile1"value="This will be replaced by KeyPerFile." />
54
54
<addkey="SECRETFROMFILE2"value="As will this one." />
55
55
<addkey="SubFeature--FeatureSecretA"value="This will be replaced by KeyPerFile if keyDelimiter is set to '--'." />
@@ -62,11 +62,11 @@
62
62
<!-- key="Secret3" value="Will be added by KV3:Latest3. IFF already added, will be "updated" by KV1 to Latest3. KV2 and KV4 don't have versions matching this secret." -->
63
63
</appSettings>
64
64
65
-
<connectionStringsconfigBuilders="SimpleJson">
66
-
<addname="jsonConnectionString1"connectionString="Will be replaced by 'SimpleJson' in 'Flat' AND 'Sectional' jsonModes, but with different values." />
67
-
<addname="connectionStrings:jsonConnectionString1"connectionString="Will only be replaced by 'SimpleJson' in 'Flat' jsonMode." />
68
-
<addname="jsonConnectionString2"connectionString="Will only be replaced by 'SimpleJson' in 'Sectional' jsonMode." />
69
-
<addname="customSettings:jsonConnectionString2"connectionString="Will be replaced by 'SimpleJson' in 'Flat' jsonMode." />
65
+
<connectionStringsconfigBuilders="Json">
66
+
<addname="jsonConnectionString1"connectionString="Will be replaced by 'Json' in 'Flat' AND 'Sectional' jsonModes, but with different values." />
67
+
<addname="connectionStrings:jsonConnectionString1"connectionString="Will only be replaced by 'Json' in 'Flat' jsonMode." />
68
+
<addname="jsonConnectionString2"connectionString="Will only be replaced by 'Json' in 'Sectional' jsonMode." />
69
+
<addname="customSettings:jsonConnectionString2"connectionString="Will be replaced by 'Json' in 'Flat' jsonMode." />
Copy file name to clipboardExpand all lines: src/packages/ConfigurationBuilders.AzureAppConfiguration.nupkg/Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration.nuspec
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@
7
7
<owners>Microsoft</owners>
8
8
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<description>In .Net 4.7.1, the configuration system allows applications to use ConfigurationBuilders to build up and modify configuration at runtime when it is loaded. This package provides a base framework to ease development of simple key/value configuration builders.</description>
11
-
<summary>A base framework for simple key/value Configuration Builders for the .Net Desktop Framework.</summary>
10
+
<description>In .Net 4.7.1, the configuration system allows applications to use ConfigurationBuilders to build up and modify configuration at runtime when it is loaded. This package provides a base framework to ease development of basic key/value configuration builders.</description>
11
+
<summary>A base framework for basic key/value Configuration Builders for the .Net Framework.</summary>
Copy file name to clipboardExpand all lines: src/packages/ConfigurationBuilders.Environment.nupkg/Microsoft.Configuration.ConfigurationBuilders.Environment.nuspec
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@
7
7
<owners>Microsoft</owners>
8
8
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
0 commit comments