简体   繁体   中英

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>

I got it. I just had to do:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM