Table of Contents

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 IConfiguration

the configuration the provider uses when resolving placeholders

logFactory ILoggerFactory

the 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 ILoggerFactory

the logger factory to use

Properties

Configuration

Gets the configuration this placeholder resolver wraps

public IConfiguration Configuration { get; }

Property Value

IConfiguration

Providers

public IList<IConfigurationProvider> Providers { get; }

Property Value

IList<IConfigurationProvider>

ResolvedKeys

public IList<string> ResolvedKeys { get; }

Property Value

IList<string>

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 string

The 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

key string

The key.

value string

The value.

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

key string

The key.

value string

The value.

Returns

bool

True if a value for the specified key was found, otherwise false.