Reason for comma splitting in config?


#1

This is the specific line I’m referring in github. I’d like to know the reason for splitting on commas here, because I think it creates unintuitive and undesirable behavior. For example, if in your application.yml you provide a docker-cmd like ["R", "-e", "shiny::runApp(appDir='/path', port=3838, host='0.0.0.0')"], the last element of that array will be split into 3 parts around the commas separating the parameters of the runApp function. I’d be happy to create a PR to change this behavior, but I wanted to first see if there is a good use case for it.

Thanks


#2

Hi @cwillia9,

You can tell Docker which commands to run by providing a list of commands. Instead of running a command as a string, it takes a list (array) and pieces them together.

I can’t remember why Docker does it that way. But your last part in your array "shiny::runApp(appDir='/path', port=3838, host='0.0.0.0')" shouldn’t be broken into multiple parts because the string is built with quotations and the parameters are using apostrophes. If that was an issue, I’m sure you could escape the apostrophes.

Hope this helps!


#3

Hey @Kalob,

Thanks for your reply. I think you may have misunderstood my problem. I am passing my command as an array of strings. The problem I’m describing happens when one of the pieces of the command contains commas, which can’t be avoided in the example I provided. In that case, that individual chunk will by split on commas via this function. That seems like strange behavior to me and I am wondering if there is a good reason for it.


#4

Hi @cwillia9,

Good catch! You are right that this causes unintended behaviour if the arguments contain commas themselves.
The original intent was to support this unofficial YAML notation:

groups: scientists, mathematicians

I.e. collections without brackets. Which is used a lot (unfortunately) in our example yamls.
Going forward, I think we’ll want to enforce official YAML notation:

groups: [scientists, mathematicians]

and remove this splitting behavior. A PR (on the develop branch) would be much appreciated.