How does conn_params work?

I’m trying to sort out an issue with rstudio-server 1.4 authentication, which I posted about here: RStudio when launched without Singularity is having strange troubles with authentication - #53 by griznog but in troubleshooting that I realized conn_params isn’t working as I’d expect it to. What I expect is that if I set in the app config

# submit.yml.erb
conn_params:
  - bubba

then in template/before.sh.erb I add

export bubba=BUBBAWASHERE

that I can then use in view.html.erb

<input type="hidden" name="bubba" value="<% bubba %>"/>

and the result on the rendered page should be

<input type="hidden" name="bubba" value="BUBBAWASHERE"/>

but instead I get

<input type="hidden" name="bubba" value=""/>

What’s the correct way to get something into view.html.erb via conn_params?

In case it helps, I am trying this with 2.0.17.

griznog

You’re so close! conn_params work just like you’re using them. But your ERB rendering is off.

You need <%= (vs just <%). This means the output will be a part of the template. The former (what you have) simply executes the block, doesn’t actually add anything to the output template.

value="<%= bubba %>"

Sorry, that was a typo, adding the = doesn’t help I still don’t get that value in the rendered page.

(edit to add copy paste)

<input type="hidden" name="bubba" value="<%= bubba %>"/>

submit.yml.erb:

conn_params:
        - csrf_token
        - bubba 

Do you see it in the connection.yml?

No, nothing in there but host, port and password.

Then next I’d check if it’s in the right YAML structure. I mean as an element to batch_connect (with all the right spacing/tabbing for YAML).

1 Like

Yep, that was it. Thank you!!. I looked at that dozens of times without seeing I needed indentation there.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.