1- ---
2- {% - set global = global | default ({}) -%}
3- {% - set imageNamePrefix = global .imageNamePrefix | default ('ghcr.io/cisco-open/' ) -%}
4- {% - set imageNameSuffix = global .imageNameSuffix | default ('latest' ) -%}
5- {% - set serviceDefaultPort = global .serviceDefaultPort | default (80) -%}
6- {# Ensure the variable always ends with a slash #}
7- {% - set imageNamePrefix = imageNamePrefix if imageNamePrefix .endswith ('/' ) else imageNamePrefix + '/' %}
81services:
9- {% - if services is defined and services is mapping %}
10- ## services
11- {% - for name , details in services .items () %}
2+ {% - for scope , scopeDetails in scopes . items () %}
3+ ## {{ scope }}
4+ {% - for name , details in scopeDetails .items () %}
125 {{ name }}:
13- image: {{ imageNamePrefix }}app-simulator-services -{{ details.type }}:{{ imageNameSuffix }}
6+ image: {{ global. imageNamePrefix }}app-simulator-{{ scope }} -{{ details.type }}:{{global. imageNameSuffix }}
147 {% - if details .port is defined %}
158 ports:
16- - "{{ details.port }}:8080 "
9+ - "{{ details.port }}:{{ global.defaultPorts[scop e] }} "
1710 {% - endif %}
18- {% - if serviceDefaultPort != 8080 %}
11+ {% - if global .defaultPorts is defined -%}
12+ {% - if global .defaultPorts [scope ] is defined and global .defaultPorts [scope ] != global ._defaultDefaultPorts [scope ] %}
1913 environment:
20- SERVICE_DEFAULT_PORT: "{{ serviceDefaultPort }}"
21- {% - if serviceDefaultPort <= 1024 %}
14+ - {{ scope | singularize | upper }}_DEFAULT_PORT={{ global.defaultPorts[scope] }}
15+ {% - endif %}
16+ {% - if global .defaultPorts [scope ] <= 1024 %}
2217 cap_add:
23- - NET_BIND_SERVICE
24- {% - endif %}
18+ - NET_BIND_SERVICE
19+ {% - endif %}
2520 {% - endif %}
2621 configs:
27- - source: service_{{ name | replace("-", "_") }}_config
28- target: /config.json
29- {% - endfor %}
30- {% - endif -%}
31- {% - if databases is defined and databases is mapping %}
32- ## databases
33- {% - for name , details in databases .items () %}
34- {{ name }}:
35- image: {{ imageNamePrefix }}app-simulator-databases-{{ details.type }}:{{ imageNameSuffix }}
36- configs:
37- - source: database_{{ name | replace("-", "_") }}_config
38- target: /config.json
39- {% - endfor %}
40- {% - endif -%}
41- {% - if loaders is defined and loaders is mapping %}
42- ## loaders
43- {% - for name , details in loaders .items () %}
44- {{ name }}:
45- image: {{ imageNamePrefix }}app-simulator-loaders-{{ details.type }}:{{ imageNameSuffix }}
46- configs:
47- - source: loader_{{ name | replace("-", "_") }}_config
22+ - source: {{ scope }}_{{ name | replace("-", "_") | lower }}_config
4823 target: /config.json
4924 {% - endfor %}
50- {% - endif %}
25+ {% - endfor %}
5126configs:
52- {% - if services is defined and services is mapping %}
53- {% - for name , details in services .items () %}
54- service_{{ name | replace("-", "_") }}_config:
55- content: |
56- {{ details | tojson }}
57- {% - endfor -%}
58- {% - endif %}
59- {% - if databases is defined and databases is mapping %}
60- {% - for name , details in databases .items () %}
61- database_{{ name | replace("-", "_") }}_config:
62- content: |
63- {{ details | tojson }}
64- {% - endfor -%}
65- {% - endif %}
66- {% - if loaders is defined and loaders is mapping %}
67- {% - for name , details in loaders .items () %}
68- loader_{{ name | replace("-", "_") }}_config:
27+ {% - for scope , scopeDetails in scopes .items () %}
28+ {% - for name , details in scopeDetails .items () %}
29+ {{ scope }}_{{ name | replace("-", "_") | lower }}_config:
6930 content: |
7031 {{ details | tojson }}
7132{% - endfor -%}
72- {% - endif %}
33+ {% - endfor %}
0 commit comments