geoand
geoand

Reputation: 64099

How can I override properties in Quarkus?

I would like to override the properties I have configured in my configuration file in my Quarkus application.

How can I accomplish that?

Upvotes: 10

Views: 14589

Answers (2)

daegyu
daegyu

Reputation: 106

Other way to override properties is using Quarkus Profiles. This way you can create separated application files for each environment (if intended). For specific environment config file, include the profile name before all properties

Base application file:

quarkus:
    http:
        port: 9090

Environment specific config file:

"%dev":
    quarkus:
        http:
            port: 8181

enter image description here

Upvotes: 0

geoand
geoand

Reputation: 64099

Properties in Quarkus are generally configured in src/main/resources/application.properties.

This is true both for properties that configure the behavior of Quarkus (like the http port it listens to or the database URL to connect to for example) and properties that are specific to your application (for example a greeting.message property).

The overridability of the former depends on the configuration in question. For example, the http properties (like quarkus.http.port) are overridable.

The later are always overridable at runtime.

When running a Quarkus application in JVM mode you can, for example, do:

java -Dgreeting.message=hi -jar example-runner.java

Similarly, when running a Quarkus application that has been converted to a native binary using the GraalVM (specifically the SubstrateVM system), you could do:

./example-runner -Dgreeting.message=hi

More information can be found on the "Quarkus - Configuring Your Application" official guide

Upvotes: 14

Related Questions