funtoos
funtoos

Reputation: 385

Setting variables in application.properties, the build fails

In application.properties I want to use variables as below.

quarkus.datasource.db-kind=${DATASOURCE_DB_KIND}
quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_URL}:${DB_PORT}/${DB_DATABASENAME}?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=require
quarkus.datasource.username=${DB_USERID}
quarkus.datasource.password=${DB_PWD}

But when I run a build

./mvnw clean package 

getting error

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.5.2.Final:build (default) on project graphql-mp: Failed to build quarkus application: java.util.NoSuchElementException: Property DATASOURCE_DB_KIND not found 

Upvotes: 0

Views: 4635

Answers (1)

Guillaume Smet
Guillaume Smet

Reputation: 10539

This fails because you didn't define the environment variable DATASOURCE_DB_KIND.

If you want it to be able to work without one defined, you need to set a default value and use something like ${DATASOURCE_DB_KIND:yourdefaultvalue}.

Upvotes: 3

Related Questions