Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate ConfigurationFile.ini dynamically from attributes #94

Open
ghost opened this issue Jun 28, 2017 · 1 comment
Open

generate ConfigurationFile.ini dynamically from attributes #94

ghost opened this issue Jun 28, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 28, 2017

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

@vaibhavdbachef
Copy link

how to override default.rb attribute value at run time ex- name of the sqlserver instance, components port etc. Can you please send some running example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants