Reputation: 314
I'm trying to dynamic change create a nginx xonfig file with chef using an erb. What is the correct syntax for if else it an .erb file.
The below code gives me an error
(erubis):17: syntax error, unexpected tINTEGER, expecting keyword_end
<% node['dd']['pipeline']['env'] -%>
resolver <%if node['dd']['pipeline']['env'] == "production" then 10.100.0.5 else 10.0.0.5 end -%> valid=30s;
Upvotes: 2
Views: 4794
Reputation: 54267
Because 10.100.0.5
isn't a valid Ruby literal. You want this:
<%= if node['dd']['pipeline']['env'] == "production" then "10.100.0.5" else "10.0.0.5" end %>
Upvotes: 2