Search code examples
javapostgresqlenvironment-variablesapplication.propertiesquarkus

Quarkus how to set environment variables in application.properties


recently I swapped from thorntail to quarkus and I'm facing some difficulties trying to find how to set environment variables in application.properties in thorntail I used something like this ${env.HOST: localhost} that basically means put environment variable, if you don't find anything put localhost as default is that possible to quarkus application.properties? I haven't found any issue on GitHub or someone that have an answered this problem?


Solution

  • 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.

    See this for more information.