Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML: How can I create a multi-line string of comma delimited values?

I am using YAML to pass in a string of comma delimited values for a new relic config file to ignore errors. I need the output to look like this:

"NotFoundError,LocationError,InvalidParamsError"

I tried using folded style and stripping the last newline. My yaml file looks like this:

ignore_errors: >-
  NotFoundError,
  LocationError,
  InvalidParamsError

However, it parses the other newlines as a space in the end giving me something like this:

"NotFoundError, LocationError, InvalidParamsError"

I need it to parse the folded string and not add spaces. Please help.

like image 573
Alex Pan Avatar asked Oct 19 '25 11:10

Alex Pan


1 Answers

The only way to do this is to quote your string and escape the end of each line with \:

ignore_errors: "\
  NotFoundError,\
  LocationError,\
  InvalidParamsError"
like image 187
TomDotTom Avatar answered Oct 22 '25 03:10

TomDotTom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!