{
  "service": {
<% if @service['id'] %>
    "id": "<%= @service['id'] %>",
<% end %>
<% if @service['tags'] %>
    "tags": "<%= @service['tags'] %>",
<% end %>
<% if @service['port'] %>
    "port": <%= @service['port'] %>,
<% end %>
<% if @service['type'] %>
    "check": {
  <% if @service['type'] == :script %>
      "script": "<%= @service['script'] %>",
      "interval": "<%= @service['interval'] %>"
  <% elsif @service['type'] == :ttl %>
      "ttl": "<%= @service['ttl'] %>"
  <% end %>
    }
<% end %>
    "name": "<%= @service['name'] %>"
  }
}

{
  "service": {
<% if @service['id'] %>
    "id": "<%= @service['id'] %>",
<% end %>
<% if @service['tags'] %>
    "tags": ["<%= @service['tags'].join('","') %>"],
<% end %>
<% if @service['port'] %>
    "port": <%= @service['port'] %>,
<% end %>
<% if @service['type'] %>
    "check": {
  <% if @service['type'] == :script %>
      "script": "<%= @service['script'] %>",
      "interval": "<%= @service['interval'] %>"
  <% elsif @service['type'] == :ttl %>
      "ttl": "<%= @service['ttl'] %>"
  <% end %>
    }
<% end %>
    "name": "<%= @service['name'] %>"
  }
}

Make tags expand out in templates properly.
Make tags expand out in templates properly.
