cam_cudi
cam_cudi

Reputation: 41

Environment variables in .erb file

I am creating a dashboard with dashing. I have some environment variables I am using in my jobs .rb file. Whenever I try to use any environment variable in my dashboard .erb file it doesnt seem to work. I am trying to put the environment variable within a url. My environment variable is #{ENV['Variable']}. Any ideas how to get environment variables to work in .erb file?

<script type='text/javascript'>
$(function() {
  Dashing.widget_base_dimensions = [170, 170]
  Dashing.numColumns = 10
});
</script>

<% content_for :title do %>xxxxxx<% end %>

<div class="gridster">
    <ul>
        <li data-row="2" data-col="1" data-sizex="3" data-sizey="3" onClick="javascript: window.open('https://xxxxxxx.#{ENV['Variable']}.xxxxxxx.com', '_blank');">
            <div data-id="xxxxx" data-view="xxxxx" data-title="xxxxxxx" data-descriptiontitle="xxxxxxx" data-min="0" data-max="100"></div>
        </li>

    </ul>
</div>

Upvotes: 1

Views: 4739

Answers (1)

cam_cudi
cam_cudi

Reputation: 41

I got it. I just had to do:

'https://xxxxx.<%= ENV['ENVHOST'] %>.xxxxx.com/'

Upvotes: 3

Related Questions