- java.lang.Object
-
- io.helidon.config.yaml.YamlMpConfigSource
-
- All Implemented Interfaces:
org.eclipse.microprofile.config.spi.ConfigSource
public class YamlMpConfigSource extends Object implements org.eclipse.microprofile.config.spi.ConfigSource
MicroProfileConfigSourcethat can be used to add YAML files from classpath or file system using theConfigProviderResolver.getBuilder().The YAML file is transformed to a flat map as follows:
Object nodesEach node in the tree is dot separated.
server: host: "localhost" port: 8080Will be transformed to the following properties:server.host=localhost server.port=8080
List nodes (arrays)Each node will be indexed (0 based)
providers: - abac: enabled: true names: ["first", "second", "third"]Will be transformed to the following properties:providers.0.abac.enabled=true names.0=first names.1=second names.2=third
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.eclipse.microprofile.config.spi.ConfigSourcecreate(String name, Reader content)Create from YAML content as a reader.static org.eclipse.microprofile.config.spi.ConfigSourcecreate(URL url)Load a YAML config source from URL.static org.eclipse.microprofile.config.spi.ConfigSourcecreate(Path path)Load a YAML config source from file system.StringgetName()Map<String,String>getProperties()StringgetValue(String propertyName)
-
-
-
Method Detail
-
create
public static org.eclipse.microprofile.config.spi.ConfigSource create(Path path)
Load a YAML config source from file system.- Parameters:
path- path to the YAML file- Returns:
- config source loaded from the file
- See Also:
create(java.net.URL)
-
create
public static org.eclipse.microprofile.config.spi.ConfigSource create(URL url)
Load a YAML config source from URL. The URL may be any URL which is support by the used JVM.- Parameters:
url- url of the resource- Returns:
- config source loaded from the URL
-
create
public static org.eclipse.microprofile.config.spi.ConfigSource create(String name, Reader content)
Create from YAML content as a reader. This method will NOT close the reader.- Parameters:
name- name of the config sourcecontent- reader with the YAML content- Returns:
- config source loaded from the content
-
getProperties
public Map<String,String> getProperties()
- Specified by:
getPropertiesin interfaceorg.eclipse.microprofile.config.spi.ConfigSource
-
getValue
public String getValue(String propertyName)
- Specified by:
getValuein interfaceorg.eclipse.microprofile.config.spi.ConfigSource
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.eclipse.microprofile.config.spi.ConfigSource
-
-