Add common part with DevopPortal
The services definitions which are located at metadata/service/services
will be moved onto the system level, to be re-used in particular
components.
Change-Id: I227638b7a486c156578e5b0d57eb6eb4d9854a89
diff --git a/devops_portal/files/config.json b/devops_portal/files/config.json
new file mode 100644
index 0000000..bb07fae
--- /dev/null
+++ b/devops_portal/files/config.json
@@ -0,0 +1,26 @@
+{%- from "devops_portal/map.jinja" import control with context -%}
+{%- from "devops_portal/map.jinja" import services 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 %}
+ "{{ key }}": "{{ value }}"
+{%- endfor %}
+}
+{%- endmacro %}
+{
+ "services": {
+ {%- for service_name, service in salt['devops_utils.iter_items'](services, control.services) %}
+ {%- if not loop.first %},{% endif -%}
+ {%- if service|length() > 0 and service.enabled %}
+ "{{ service_name }}": {
+ "endpoint": "{{ service.endpoint }}"
+ {%- if service.credentials is defined and service.credentials|length() > 0 -%},
+ {{ credentials(service.credentials)|indent(width=8) }}
+ {%- endif %}
+ }
+ {%- endif %}
+ {%- endfor %}
+ }
+}