0

We've used quarkus as basement for new project services. Considering its configuration, it can be configured using yml files.

To follow this way, added

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-config-yaml</artifactId>
</dependency>

yml configuration applied. To improve this configuration, I'd like to have a chance put some configurations in different files and combine them together, depending on...

For example I need next configurations in separate files:

  • application-postgre-ds.yml
  • application-oracle-ds.yml
  • application-xxx-ds.yml
  • ...
  • application-apigee.yml

I'd like to manage them in my main profile configuration like other profiles imports

quarkus:
  profiles:
    include: postgre-ds, oracle-ds

or like imports from classpath

quarkus:
  import:
    config: classpath:application-postgre-ds.yml;application-oracle-ds.yml

but haven't detected nothing useful in their documentation.

I hope I missed correct instruction and someone would help me make working combined configuration.

Sergii
  • 7,044
  • 14
  • 58
  • 116

1 Answers1

1

This is partially supported by Quarkus:

It is possible to have specific configurations files per profile: https://quarkus.io/guides/config-reference#profile-aware-files

But in Quarkus, you can only have a single profile active. For instance, if the profile dev is active, Quarkus will load configurations both from application-dev.properties and the main file application.properties. Configuration from the profile-aware file has priority.

There is also the notion of a parent profile, which you can use to share common configuration across multiple profiles: https://quarkus.io/guides/config-reference#parent-profile

If you really need the multi-profile approach, as I said, Quarkus does not officially support it, but it is supported by SmallRye Config (used by Quarkus): https://smallrye.io/smallrye-config/latest/config/profiles/#multiple-profiles. It should work for this use case, but it is not integrated into Quarkus, so some Quarkus features around configuration profiles will not work properly. For instance, the @IfBuildProfile and @UnlessBuildProfile annotations, but there are more cases. So use it carefully.

Roberto Cortez
  • 803
  • 4
  • 8