-
Notifications
You must be signed in to change notification settings - Fork 11
MorestachioConfigExtensions
With the Nuget package Morestachio.Configuration.Transform
it is possible to add an Transformer to your IConfiguration provider that will utilize Morestachio to transform your Configuration entries.
This is helpful when you have several instances of an application or asp.core server that should behave differently or you want to transform user provided settings.
To enable the morestachio transformation you have to enable it on the IConfigurationBuilder. You can add one of two transformers and configuration them by using the extension methods in Morestachio.Configuration.Transform.MorestachioConfigExtensions
.
The extension method MorestachioConfigExtensions.UseRuntimeMorestachio()
wraps the underlying IConfigurationProvider and will process each requested configuration item every time it is requested.
With the MorestachioConfigExtensions.UseBuildtimeMorestachio()
method you will get an IConfigurationBuilder that will transform your config entries only once when the ConfigurationProvider is build.
You can set several options with the IMorestachioConfigurationBuilder
returned from ether extension method.
This adds your own custom ParserOptions to the transformation in case you want to supply any custom formatters.
As the IMorestachioConfigurationBuilder
will filter thoese items it process, you can set your custom filter here
This allows you to add values to your expression ether globally when the key
parameter is null or to a specific path where the values are only used on that path and its children.