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

Indent modifiers should not trim orignal spaces #633

Open
abc225666 opened this issue May 7, 2024 · 0 comments
Open

Indent modifiers should not trim orignal spaces #633

abc225666 opened this issue May 7, 2024 · 0 comments

Comments

@abc225666
Copy link

Is your feature request related to a problem? Please describe.
I am trying to use a multiline string from the Vault and embed it into a subsequence. The multiline string may have its indent stored in the Vault. Here is one example:

{
  "json_field1": "value",
  "json_field2": "value"
}

And the secret resource would be like:

apiVersion: v1
stringData:
  key: |
    some_key: "some_value"
    embed_key: |
      <path:secret/data/mysecret#credential>
...

The result generated is:

apiVersion: v1
stringData:
  key: |
    some_key: "some_value"
    embed_key: |
      {
      "json_field1": "value",
      "json_field2": "value"
    }
...

I have read issues #297 and #451. I trying to add indent 4 after the substitution like <path:secret/data/mysecret#credential | indent 4>. But the result becomes:

apiVersion: v1
stringData:
  key: |
    some_key: "some_value"
    embed_key: |
      {
        "json_field1": "value",
        "json_field2": "value"
        }
...

The indent of the last line is broken. Then I checked the source code of handling indent. It trimmed spaces before adding the selected level of spaces into the lines.

Describe the solution you'd like
I think the indent function should keep the original spaces and add the selected number of spaces into the strings.

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

No branches or pull requests

1 participant