mendix / m2ee-tools

m2ee, the Mendix runtime helper tools for GNU/Linux
Other
27 stars 40 forks source link

Multi line variable support in m2ee.yaml? #50

Open hvisage opened 4 years ago

hvisage commented 4 years ago

Good day,

How/which multi-line constant string values are allowed? Don't see any example/

Have the need to insert a JSON set of values, that would be inserted with jinga2 (from Ansible) template, but the looping makes it a challenge to put in a single JSON line.

The alternative is to have a complex yaml variable, but the developer seems to be insistent that is not possible, only JSON & XML from the from the m2ee.yaml file.

Any other advice directions?

knorrie commented 4 years ago

I might not fully understand what your goal is, yet, but yaml has several ways to include multi-line content. They're the 'block scalar style' formatting things.

So, a simple way to put multi line text in a constant would be:

foo: |
 this is the first line
 this is the second line
 and now I can write a whole book

and if you want to write multiple lines that get concatted into one line:

foo: >-
 {
 "this": "is",
 "some": "json",
 }

Disclaimer: I never tried this myself. What I do know is that a constant of string type in Mendix is just a string, so I'm pretty sure it can have line breaks in it.

hvisage commented 4 years ago

I just need/want to confirm that the m2ee script/apps will be sending that as a single string to the Mendix model to parse and not split/etc. it.

knorrie commented 4 years ago

The easiest way to confirm is to just try it and see what is sent. m2ee -vvv can be used to view admin port traffic in the TRACE level logging.