quarkus: Wrong Property Expressions evaluation

Describe the bug When an application.properties has an expression with the character {, Quarkus evaluates the expression wrong.

Expected behavior If I have the property:

key = ${TOKEN:111111{11}

Using the annotation @ConfigProperty(name = "key"), I would expect to get the value:

  • key: 111111{11

Actual behavior The problem is, the configuration doesn’t understand the chart { in the middle of an expression, and it doesn’t close the expression correctly. The result of the previous case is: key: 111111{11} -> This includes the curly brace that closes the expression }.

I tried to scape the curly brace in the expression:

key = ${TOKEN:111111\{11}

But, I got the same result: 111111{11}. The walkaround that I found is not to close the expression:

key = ${TOKEN:111111{11

That looks wrong to me.

To Reproduce Steps to reproduce the behavior:

  1. Add an expression in the application.properties file with a curly brace key=${SOMETHING:0000{0000}

Configuration

key=${SOMETHING:0000{0000}

Environment (please complete the following information):

  • Output of uname -a or ver:
Darwin WALT952837.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
  • Output of java -version:
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: I tested on Quarkus 1.5.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
------------------------------------------------------------
Gradle 6.4.1
------------------------------------------------------------

Build time:   2020-05-15 19:43:40 UTC
Revision:     1a04183c502614b5c80e33d603074e0b4a2777c5

Kotlin:       1.3.71
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
OS:           Mac OS X 10.14 x86_64

Thanks

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

IMHO we should provide a way to escape it, since generated passwords may contain braces, so asking the developer to perform changes in the code to support that looks weird to me 😃

This is my case. I had an API key with braces. My walkaround was adding a key with the token and use it in the expression key=${TOKEN:${token}}

IMHO we should provide a way to escape it, since generated passwords may contain braces, so asking the developer to perform changes in the code to support that looks weird to me 😃