formula-consul/consul/files/services.json
2015-10-10 00:39:53 +03:00

16 lines
500 B
JSON

{% from "consul/map.jinja" import consul with context %}
{
"services": [
{% for service in consul.register.items() %}
{
{% for key, value in service.items() %}
{% if key == 'script' %}
"{{ script }}": "/opt/consul/scripts/"{{ value.split('/')[-1] }}{% if not loop.last %},{% endif %}
{% else %}
"{{ key }}": {{ value | json}}{% if not loop.last %},{% endif %}
{% endif %}
{% endfor %}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}