formula-consul/consul/files/services.json

25 lines
764 B
JSON
Raw Normal View History

2015-10-09 17:39:53 -04:00
{% from "consul/map.jinja" import consul with context %}
{
"services": [
2015-10-09 17:46:19 -04:00
{% for service in consul.register %}
2015-10-09 17:39:53 -04:00
{
{% for key, value in service.items() %}
2015-10-09 17:58:08 -04:00
{% 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 %}
2015-10-09 17:39:53 -04:00
{% else %}
"{{ key }}": {{ value | json}}{% if not loop.last %},{% endif %}
{% endif %}
{% endfor %}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}