Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML: dotted attributes escape sequence #2327

Open
stanislavbebej-ext43345 opened this issue Sep 14, 2023 · 0 comments
Open

YAML: dotted attributes escape sequence #2327

stanislavbebej-ext43345 opened this issue Sep 14, 2023 · 0 comments

Comments

@stanislavbebej-ext43345

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant