Skip to content

FileSystem Config Source#

This Config Source loads configuration values for each file found in a directory. Each file corresponds to a single property, where the file name is the configuration property name and the file content the configuration value.

For instance, if a directory structure looks like:

foo/
|__num.max
|__num.size

The FileSystem Config Source will provide 2 properties:

  • num.max
  • num.size

Warning

Nested directories are not supported.

This Config Source can be used to read configuration from Kubernetes ConfigMap. Check the Kubernetes ConfigMap ConfigSource Example.

The same mapping rules as defined for environment variables are applied, so the FileSystem Config Source will search for a given property name num.max:

  • Exact match (num.max)
  • Replace each character that is neither alphanumeric nor _ with _ (num_max)
  • Replace each character that is neither alphanumeric nor _ with _; then convert the name to upper case (NUM_MAX)

The following dependency is required in the classpath to use the FileSystem Config Source:

<dependency>
    <groupId>io.smallrye.config</groupId>
    <artifactId>smallrye-config-source-file-system</artifactId>
    <version>3.10.1</version>
</dependency>

The configuration property smallrye.config.source.file.locations sets the directory paths to look up the files. It accepts multiple locations separated by a comma and each must represent a valid URI to a directory.