Class FileSystemConfigSource

java.lang.Object
io.smallrye.config.common.AbstractConfigSource
io.smallrye.config.common.MapBackedConfigSource
io.smallrye.config.source.file.FileSystemConfigSource
All Implemented Interfaces:
Serializable, org.eclipse.microprofile.config.spi.ConfigSource

public class FileSystemConfigSource extends io.smallrye.config.common.MapBackedConfigSource
Read configuration from a file directory.

Each file in the directory corresponds to a property where the file name is the property key and the file textual content is the property value.

For example, if a directory structure looks like:

 
 foo/
 ├── num.max
 └── num.size
 
 
new FileSystemConfigSource(new File("foo"), 100) will provide 2 properties:
  • num.max
  • num.size

Nested directories are not supported.

Author:
Jeff Mesnil (c) 2017 Red Hat inc.
See Also:
  • Field Details

  • Constructor Details

    • FileSystemConfigSource

      public FileSystemConfigSource(File dir)
    • FileSystemConfigSource

      public FileSystemConfigSource(String dir)
    • FileSystemConfigSource

      public FileSystemConfigSource(File dir, int ordinal)
      Construct a new instance
      Parameters:
      dir - the directory, containing configuration files
      ordinal - the ordinal value
  • Method Details

    • getValue

      public String getValue(String name)
      Specified by:
      getValue in interface org.eclipse.microprofile.config.spi.ConfigSource
      Overrides:
      getValue in class io.smallrye.config.common.MapBackedConfigSource