I need to get the servername (configured in ood_portal.yml) from an interactive application.
Is this variable available there? Is the list of available ruby methods/instances/variables relates to OOD documented anywhere? It would be quite useful to know the information I can access at every interactive application “stage” (like session or context instances available in the template scripts).
Thanks in advance for your help!
The only page I can think of with the type of info you are asking is here:
cluster_id in the
session will give you the cluster names, but it sounds like you want the name of the web-node? is that right?
Thanks a lot for the info about the available objects.
I indeed wanted to access the “servername” info dynamically but for the moment I think I will avoid using it.
Many thanks for your help!
Technically, because it’s ERB, you can access any Ruby library available. So you may be able to just use
Socket.gethostname directly (should you need it in the future).
Thanks @jeff.ohrstrom. I tried
Socket.gethostname, but it didn’t work in our environment because the configured hostname is not the same as the external hostname (i.e.
Next, I used the YAML module to parse ood_portal.yml file. Kind of hacky, but it worked in our dev environment. It failed in production because the permissions on that file are more restrictive there.
Finally, I found another solution. I added a hidden field in our form and populated it from form.js, as follows:
// set the base url (see before.sh.erb and entrypoint.sh)
$(‘#mwi_base_url’).val(window.location.protocol + ‘//’ + window.location.host)
Then, I reference the value in our template scripts via