From 99a4bdded557cb67c773ffaf0421a8f6c53ca029 Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Sat, 14 Dec 2024 11:10:37 +0500 Subject: [PATCH 1/2] fix: render mfe-ports for unmounted mfes when these exist --- .../patches/local-docker-compose-dev-services | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tutormfe/patches/local-docker-compose-dev-services b/tutormfe/patches/local-docker-compose-dev-services index 4d952e50..e90cef79 100644 --- a/tutormfe/patches/local-docker-compose-dev-services +++ b/tutormfe/patches/local-docker-compose-dev-services @@ -1,10 +1,17 @@ +{%- set unmounted_mfes = [] %} +{%- for app_name, app in iter_mfes() %} + {%- if not iter_mounts(MOUNTS, app_name)|list %} + {%- set _ = unmounted_mfes.append((app_name, app)) %} + {%- endif %} +{%- endfor %} +{% if unmounted_mfes|length > 0 %} mfe: - ports: - {%- for app_name, app in iter_mfes() %} - {%- if not iter_mounts(MOUNTS, app_name)|list %} - - {{ app["port"] }}:8002 # {{ app_name }} - {%- endif %} - {%- endfor %} + ports: + {%- for app_name, app in unmounted_mfes %} + - {{ app["port"] }}:8002 # {{ app_name }} + {%- endfor %} +{% endif %} + {%- for app_name, app in iter_mfes() %} {%- set mounts = iter_mounts(MOUNTS, app_name)|list %} From d72eb5e438a02acf794bbbcbe000d9db01a4a089 Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Mon, 13 Jan 2025 14:11:07 +0500 Subject: [PATCH 2/2] fix: re-arrange the patch code --- .../patches/local-docker-compose-dev-services | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tutormfe/patches/local-docker-compose-dev-services b/tutormfe/patches/local-docker-compose-dev-services index e90cef79..82d648b8 100644 --- a/tutormfe/patches/local-docker-compose-dev-services +++ b/tutormfe/patches/local-docker-compose-dev-services @@ -1,17 +1,4 @@ {%- set unmounted_mfes = [] %} -{%- for app_name, app in iter_mfes() %} - {%- if not iter_mounts(MOUNTS, app_name)|list %} - {%- set _ = unmounted_mfes.append((app_name, app)) %} - {%- endif %} -{%- endfor %} -{% if unmounted_mfes|length > 0 %} -mfe: - ports: - {%- for app_name, app in unmounted_mfes %} - - {{ app["port"] }}:8002 # {{ app_name }} - {%- endfor %} -{% endif %} - {%- for app_name, app in iter_mfes() %} {%- set mounts = iter_mounts(MOUNTS, app_name)|list %} @@ -32,5 +19,16 @@ mfe: - lms environment: - "PORT={{ app['port'] }}" +{%- else %} +{%- set unmounted_mfes = unmounted_mfes.append((app_name, app)) %} {%- endif %} {%- endfor %} + + +{% if unmounted_mfes|length > 0 %} +mfe: + ports: + {%- for app_name, app in unmounted_mfes %} + - {{ app["port"] }}:8002 # {{ app_name }} + {%- endfor %} +{% endif %} \ No newline at end of file