Reputation: 102
I'm using quarkus profile-aware files to set different property values for different profiles:
quarkus.http.port=9090 # quarkus.http.port is just an example property
quarkus.http.port=9190
This works if I don't enable native-image compilation: if QUARKUS_PROFILE
environment variable is staging
, Quarkus will pick up the correct property value (i.e. 9190
).
However, when I do native compilation (quarkus.package.type=native
) it seems quarkus is using the default value (9090
); the profile-aware file is ignored by the native binary. "Profile in the property name" still works (i.e. %staging.quarkus.http.port=9190
in application.properties).
Is this the expected behavior? Or what am I missing for the native compilation to work with profile-aware files?
Upvotes: 2
Views: 1264
Reputation: 238
I solved this problem by adding the following line to the application.properties
:
quarkus.native.resources.includes=*.properties
This causes the native compilation process to include all application-*.properties
files from the resources so Quarkus can load the correct one depending on the QUARKUS_PROFILE
environment variable at runtime.
Upvotes: 2
Reputation: 64011
Using the getting-started quickstart with the addition of application-dummy.properties
quarkus.http.port=9090
when I build the application with mvn package -DskipTests -Dquarkus.profile=dummy -Dnative
then when I run it, it starts on port 9090
as expected
Upvotes: 0