formula-consul/consul/files/services.json
Bahadır Kandemir 63c49d7431 Deep scan config
2015-10-10 00:58:08 +03:00

24 lines
764 B
JSON

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