rails 3, how use an ENV config vars in a Settings.yml file?

前端 未结 4 1997
野的像风
野的像风 2020-12-25 11:22

In my settings.yml file I have several config vars, some of which reference ENV[] variables.

for example I have ENV[\'FOOVAR\'] equals WIDGET

I thought I cou

4条回答
  •  -上瘾入骨i
    2020-12-25 11:34

    Use <%= ENV['FOOVAR'] %> instead of <% ENV['FOOVAR'] %>.

    Be aware that this approach will only work if whatever is parsing the Yaml file is set up to process it via Erb (for example, you can see how Mongoid does exactly this). It's not universally supported in Yaml files though, so it depends on what you're using this Yaml file for.

提交回复
热议问题