Quarkus how to set environment variables in application.properties

Alternatively, you do not need refere environment variable in application.properties, just refere variable in your code directly:

@ConfigProperty(name = "my.property", defaultValue = "default value")
String myProperty;

and specify it using env variable like this:

export MY_PROPERTY="env var" && java -jar myapp.jar

or using command line definition -D

java -Dmy.property="CL key" -jar myapp.jar

Please refere Quarkus configuration guide https://quarkus.io/guides/config


In application.properties you can use:

somename=${HOST:localhost}

which will correctly expand the HOST environment variable and use localhost as the default value if HOST is not set.