Class EnvConfigSource
- java.lang.Object
-
- io.smallrye.config.common.AbstractConfigSource
-
- io.smallrye.config.EnvConfigSource
-
- All Implemented Interfaces:
Serializable,org.eclipse.microprofile.config.spi.ConfigSource
public class EnvConfigSource extends AbstractConfigSource
AConfigSourceto access Environment Variables following the mapping rules defined by the MicroProfile Config specification.For a given property name
foo.bar.baz, is matched to an environment variable with the following rules:- Exact match (
foo.bar.baz) - Replace each character that is neither alphanumeric nor
_with_(foo_bar_baz) - Replace each character that is neither alphanumeric nor
_with_; then convert the name to upper case (FOO_BAR_BAZ)
Additionally, this implementation provides candidate matching dotted property name from the Environment Variable name. These are required when a consumer relies on the list of properties to find additional configurations. The MicroProfile Config specification defines a set of conversion rules to look up and find values from environment variables even when using their dotted version, but it is unclear about property names.
Because an environment variable name may only be represented by a subset of characters, it is not possible to represent exactly a dotted version name from an environment variable name, so consumers must be aware of such limitations.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEnvConfigSource()protectedEnvConfigSource(int ordinal)EnvConfigSource(Map<String,String> properties, int ordinal)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>getProperties()Set<String>getPropertyNames()StringgetValue(String propertyName)-
Methods inherited from class io.smallrye.config.common.AbstractConfigSource
getName, getOrdinal, toString
-
-