When querying Spring Cloud Config with a dotted YAML attribute, it gets split into multiple lines:
Source file (application.yml):
appName: sample-app
metadata:
name: ${appName}
annotations:
app.acme.com/source: https://github.com/acme/${appName}
Expected output:
appName: sample-app
metadata:
name: sample-app
annotations:
app.acme.com/source: https://github.com/acme/sample-app
Actual output:
appName: sample-app
metadata:
name: sample-app
annotations:
app:
acme:
com/source: https://github.com/acme/sample-app
I have tried escaping the dots multiple ways, none of them worked, except for one "hack" workaround:
Source:
metadata:
name: sample-app
annotations:
default:
app.acme.com/source: https://github.com/acme/sample-app
double:
"app.acme.com/source": https://github.com/acme/sample-app
single:
'app.acme.com/source': https://github.com/acme/sample-app
doubleBr:
"[app.acme.com/source]": https://github.com/acme/sample-app
singleBr:
'[app.acme.com/source]': https://github.com/acme/sample-app
# Working workaround
hack:
${x-dottedAttribute}/source: https://github.com/acme/sample-app
# Not working workaround
hackNested:
${x-dottAtts.acme}/source: ${x-dottAtts.acme}/source
# # Not working workaround returning HTTP 400
# hackList:
# ${x-dottAttList[0]}/source: ${x-dottAttList[0]}/source
x-dottAttList:
- app.acme.com
x-dottAtts:
acme: app.acme.com
x-dottedAttribute: app.acme.com
Output:
metadata:
name: sample-app
annotations:
default:
app:
acme:
com/source: https://github.com/acme/sample-app
double:
app:
acme:
com/source: https://github.com/acme/sample-app
single:
app:
acme:
com/source: https://github.com/acme/sample-app
hack:
app.acme.com/source: https://github.com/acme/sample-app
hackNested:
acme/source: app.acme.com/source
doubleBr[app:
acme:
com/source]: https://github.com/acme/sample-app
singleBr[app:
acme:
com/source]: https://github.com/acme/sample-app
x-dottAtts:
acme: app.acme.com
x-dottedAttribute: app.acme.com
x-dottAttList:
- app.acme.com
I am using the latest Spring Cloud Config version 4.0.4 (using hyness/spring-cloud-config-server:4.0.4-jre17 docker image from dockerhub), Spring Boot v3.1.2, Java 17.0.7, "native" profile.
This might be related to the existing https://github.com/spring-cloud/spring-cloud-config/issues/1595 issue.
Is there a way to "escape" the dots in attribute so that Config Server would not interpret them? Is this expected behavior?
Thank you very much for your help.