A eclipse microprofile config (1.3) extension which uses Consul as source.
This project has been integrated in https://github.com/microprofile-extensions/config-ext
The eclipse microprofile config framework is a simple yet powerful configuration framework for Jakarta EE. But most implementations only provide the system/env properties or property files as configuration source. Consuls key/value store is a widely used configuration source, so this small library provides an ConfigSource implementation which takes the values from consul. For performance reasons, the config values are cached.
<dependency>
<groupId>ch.carve</groupId>
<artifactId>mp-config-consul</artifactId>
<version>0.7</version>
</dependency>
Currently there are 3 values you can configure, either through Java system properties or environment variables:
- configsource.consul.host url of your consul instance, e.g. "192.168.99.100:8500", default value is "localhost", variable substitution available.
- configsource.consul.validity how long to cache values (in seconds), default is 30s
- configsource.consul.prefix key prefix to search value in consul, variable substitution available
- configsource.consul.list-all whether getProperties() should query consul for all kv pairs, default is false
Note: these config values cannot be set in Quarkus application.properties!
Config sources have priorities called ordinal. This config source has ordinal 550, but can be overriden with setting 'config_ordinal' in this source (including prefix if defined)