Reputation: 425
This is myfile.yml
this_is_key:
- [<%= ENV['MY_KEY_NAME'] %>, 1]
It will return the error syntax, can not parse file.Now, i change like this:
this_is_key:
- [my_key_here, 1]
No errors occurred. Somebody can tell me, how can i pass ENV variable in my file?
Upvotes: 1
Views: 1890
Reputation: 15045
You can do it only if you parse the resulting yml
file as an erb
template:
YAML.load(ERB.new(File.read("myfile.yml")).result)
result
method passes the current binding
into template and renders the file according to the variables in the scope.
Here's an article about such experiments.
Upvotes: 2