Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centralize common config for quarkus

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?

like image 219
tobad357 Avatar asked Jun 08 '26 21:06

tobad357


1 Answers

There are three top-level approaches that I can think of.

  1. Use a shared service like Consul, Vault, ConfigMap, or Spring Config Server with the appropriate extension for your environment.
  2. 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.
  3. 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).
like image 187
John Clingan Avatar answered Jun 11 '26 16:06

John Clingan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!