Skip to content

generate ConfigurationFile.ini dynamically from attributes #94

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions