Handle configuration file creation dynamically from attributes:
./templates/default/ConfigurationFile.ini:
<% @properties.each_pair do |key, value| -%>
<% if value.is_a? Array -%>
<%= key %>=<%= value.map { |item| %("#{item}") }.join(' ') %>
<% else -%>
<%= key %>="<%= value %>"
<% end -%>
<% end -%>
example environment json:
{
"sql_server": {
"install": {
"properties": {
"key1": "value1",
"key2": "value2",
"array": ["item1", "item2", "item3"]
}
}
}
}
end result:
key1="value1"
key2="value2"
array="item1" "item2" "item3"
This way the comments are lost, but also that can be attached if really necessary
Handle configuration file creation dynamically from attributes:
./templates/default/ConfigurationFile.ini:example environment json:
{ "sql_server": { "install": { "properties": { "key1": "value1", "key2": "value2", "array": ["item1", "item2", "item3"] } } } }end result:
This way the comments are lost, but also that can be attached if really necessary