blob: 72ce97b355f14b3627a51e3f4881d0582af772a6 [file] [log] [blame]
{%- from "devops_portal/map.jinja" import config with context -%}
{%- from "devops_portal/map.jinja" import services with context -%}
{%- from "devops_portal/map.jinja" import service_url with context -%}
{%- macro credentials(parameters) -%}
{%- set keys = ['token', 'username', 'password'] -%}
"credentials": {
{%- for key, value in salt['devops_utils.iter_items'](keys, parameters) %}
{%- if not loop.first %},{% endif %}
{%- if value != None %}
"{{ key }}": "{{ value }}"{% else %}
"{{ key }}": ""{%- endif %}
{%- endfor %}
}
{%- endmacro %}
{
"services": {
{%- for service_name, service in salt['devops_utils.iter_items'](services, config.service) %}
{%- if not loop.first %},{% endif -%}
{%- if service.enabled|default(True) %}
"{{ service_name }}": {
"endpoint": "{{ service_url(service.endpoint) }}"
{%- if service.credentials is defined and service.credentials|length() > 0 -%},
{{ credentials(service.credentials)|indent(width=8) }}
{%- endif %}
}
{%- endif %}
{%- endfor %}
}
}