We have a multi-module Quarkus project with a common lib and multiple apps.
In the common lib, we have various caches that are used across all the apps.
We would prefer not to have to configure retention and capacity across all configuration files in each application.
Is there a way to centralize the config without writing our own ConfigSource.
Or is writing our own ConfigSource the preferred way?
There are three top-level approaches that I can think of.
- Use a shared service like Consul, Vault, ConfigMap, or Spring Config Server with the appropriate extension for your environment.
- Store the common configuration in config/application.properties. See Overriding Properties at Runtime step 4. Just copy config/application.properties along with your other deployment artifact(s) to your deployment location.
- Use a shared config file in your multi-module project. As far as I know, Quarkus only supports one instance each of application.properties, microprofile-config.properties, and application.yaml. You could store application properties in any one of them and the shared properties in one of the remaining two property files that is copied in during a build. Yuck, I know, and I've never tried it :-) I don't think you can point to a config file outside of the project directory, except for #2 exception above. The order of precedence is microprofile-config.properties, application.properties, and then application.yaml (from the least to most significant).