Reputation: 3733
This is the content of my.j2 template file
mvalue ={{ mvalue }}
svalue={{ svalue }}
and This is the content of the a.env file from which template files will read the value
mvalue= first line
second line
svalue=singleline
Please see the output after running the j2cli 0.3.1-0 process ( Im running it on fish terminal)
j2cli 0.3.1-0 my.j2 a.env
mvalue =first line
svalue=singleline
As you can see mvalue is getting only the First line as value. It's not getting the second line.
How can I read multi line values in j2 files?
Upvotes: 1
Views: 882
Reputation: 39768
.env
files use shell syntax to define environment variables, so you should do this:
mvalue='first line
second line'
svalue=singleline
If you want to use YAML syntax, use
j2 my.j2 a.yml
With a.yml
being
mvalue: |-
first line
second line
svalue: singleline
Upvotes: 1