Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Quotes are preserved with environment variables #77

@kylegibson-rldatix

Description

@kylegibson-rldatix

A .env file with spaces can't be sourced unless the values are quoted, but then the quotes are preserved in the rendered output, but not preserved in the shell:

$ cat test.env
FOO="one two three"

$ source test.env
$ echo $FOO
one two three

$ cat test.conf 
BAR = {{ FOO }}

$ j2 test.conf test.env 
BAR = "one two three"

If I change test.env to remove the quotes, then sourcing no longer works:

$ cat test.env
FOO=one two three

$ j2 test.conf test.env
BAR = one two three

$ source test.env
Command 'two' not found, did you mean:
...

How can I create a .env with values that have spaces that is consistent between the shell and the j2 output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions