java.lang.Object
io.helidon.config.MetaConfig
Meta configuration.
Configuration allows configuring itself using meta configuration.
Config looks for meta-config.*
files in the current directory and on the classpath, where the *
is
one of the supported media type suffixes (such as yaml
when helidon-config-yaml
module is on the classpath).
Meta configuration can define which config sources to load, including possible retry policy, polling strategy and change watchers.
Example of a YAML meta configuration file:
sources: - type: "environment-variables" - type: "system-properties" - type: "file" properties: path: "conf/dev.yaml" optional: true - type: "file" properties: path: "conf/config.yaml" optional: true - type: "classpath" properties: resource: "default.yaml"This configuration would load the following config sources (in the order specified):
- Environment variables config source
- System properties config source
- File config source from file
conf/dev.yaml
that is optional - File config source from file
conf/config.yaml
that is optional - Classpath resource config source for resource
default.yaml
that is mandatory
-
Method Summary
Modifier and TypeMethodDescriptionstatic ChangeWatcher<?>
changeWatcher
(Config metaConfig) Load a change watcher based on its meta configuration.static Config
config()
Create configuration from meta configuration (files or classpath resources), or create a default config instance if meta configuration is not present.static Config
Create configuration from provided meta configuration.static List<ConfigSource>
configSource
(Config sourceMetaConfig) Load a config source (or config sources) based on its meta configuration.Find meta configuration (files or classpath resources) and create a meta configuration instance from it.static PollingStrategy
pollingStrategy
(Config metaConfig) Load a polling strategy based on its meta configuration.static RetryPolicy
retryPolicy
(Config metaConfig) Load a retry policy based on its meta configuration.
-
Method Details
-
config
Create configuration from meta configuration (files or classpath resources), or create a default config instance if meta configuration is not present.- Returns:
- a config instance
-
config
Create configuration from provided meta configuration.- Parameters:
metaConfig
- meta configuration- Returns:
- a new config instance built from meta configuration
-
metaConfig
Find meta configuration (files or classpath resources) and create a meta configuration instance from it.- Returns:
- meta configuration if present, or empty
-
pollingStrategy
Load a polling strategy based on its meta configuration.- Parameters:
metaConfig
- meta configuration of a polling strategy- Returns:
- a polling strategy instance
-
changeWatcher
Load a change watcher based on its meta configuration.- Parameters:
metaConfig
- meta configuration of a change watcher- Returns:
- a change watcher instance
-
retryPolicy
Load a retry policy based on its meta configuration.- Parameters:
metaConfig
- meta configuration of retry policy- Returns:
- retry policy instance
-
configSource
Load a config source (or config sources) based on its meta configuration. The metaConfig must contain a keytype
that defines the type of the source to be found via providers, and a keyproperties
with configuration of the config sources- Parameters:
sourceMetaConfig
- meta configuration of a config source- Returns:
- config source instance
- See Also:
-