Class PlaceholderResolverProvider
- Namespace
- Steeltoe.Extensions.Configuration
- Assembly
- Steeltoe.Extensions.Configuration.PlaceholderBase.dll
Configuration provider that resolves placeholders A placeholder takes the form of
${some:config:reference?default_if_not_present}>
public class PlaceholderResolverProvider : IPlaceholderResolverProvider, IConfigurationProvider
- Inheritance
-
PlaceholderResolverProvider
- Implements
- Inherited Members
Constructors
PlaceholderResolverProvider(IConfiguration, ILoggerFactory)
Initializes a new instance of the PlaceholderResolverProvider class. The new placeholder resolver wraps the provided configuration
public PlaceholderResolverProvider(IConfiguration configuration, ILoggerFactory logFactory = null)
Parameters
configuration
IConfigurationthe configuration the provider uses when resolving placeholders
logFactory
ILoggerFactorythe logger factory to use
PlaceholderResolverProvider(IList<IConfigurationProvider>, ILoggerFactory)
Initializes a new instance of the PlaceholderResolverProvider class. The new placeholder resolver wraps the provided configuration providers. The Configuration will be created from these providers.
public PlaceholderResolverProvider(IList<IConfigurationProvider> providers, ILoggerFactory logFactory = null)
Parameters
providers
IList<IConfigurationProvider>the configuration providers the resolver uses when resolving placeholders
logFactory
ILoggerFactorythe logger factory to use
Properties
Configuration
Gets the configuration this placeholder resolver wraps
public IConfiguration Configuration { get; }
Property Value
Providers
public IList<IConfigurationProvider> Providers { get; }
Property Value
ResolvedKeys
public IList<string> ResolvedKeys { get; }
Property Value
Methods
GetChildKeys(IEnumerable<string>, string)
Returns the immediate descendant configuration keys for a given parent path based on this Configuration's data and the set of keys returned by all the preceding providers.
public IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string parentPath)
Parameters
earlierKeys
IEnumerable<string>The child keys returned by the preceding providers for the same parent path.
parentPath
stringThe parent path.
Returns
- IEnumerable<string>
The child keys.
GetReloadToken()
Returns a change token if this provider supports change tracking, null otherwise.
public IChangeToken GetReloadToken()
Returns
- IChangeToken
changed token
Load()
Creates the Configuration from the providers if it has not done so already. If Configuration already exists, it will call Reload() on the underlying configuration
public void Load()
Set(string, string)
Sets a configuration value for the specified key. No placeholder resolution is performed.
public void Set(string key, string value)
Parameters
TryGet(string, out string)
Tries to get a configuration value for the specified key. If the value is a placeholder it will try to resolve the placeholder before returning it.
public bool TryGet(string key, out string value)
Parameters
Returns
- bool
True
if a value for the specified key was found, otherwisefalse
.