Skip to content

Commit e5afcb1

Browse files
fix: dynamic port for LEARNING MFE in form of ENV variable
fixing the dynamic port for leaning mfe as for overiding the 2000 port to 2010 for all the mfe repos
1 parent c4b585e commit e5afcb1

File tree

7 files changed

+19
-16
lines changed

7 files changed

+19
-16
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
},
3232
"containerEnv": {
3333
"DEVSTACK_WORKSPACE": "/workspaces/edx-repos",
34-
"LEARNING_MICROFRONTEND_PORT": "2010",
35-
"LEARNING_MICROFRONTEND_URL": "http://localhost:2010",
36-
"LEARNING_MICROFRONTEND_NETLOC": "localhost:2010"
34+
"LEARNING_MICROFRONTEND_PORT": "2010"
3735
},
3836
"updateContentCommand": ".devcontainer/updateContentCommand.sh",
3937
"postCreateCommand": ".devcontainer/postCreateCommand.sh",

.devcontainer/updateContentCommand.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,8 @@ done
8484
echo "Updating .env.development files for MFE apps..."
8585

8686
# Define shared values
87-
PORT=${LEARNING_MICROFRONTEND_PORT:-2000}
88-
BASE_URL=${LEARNING_MICROFRONTEND_URL:-"http://localhost:$PORT"}
89-
90-
# Path to workspace
91-
87+
PORT=${LEARNING_MICROFRONTEND_PORT:-2010}
88+
BASE_URL="http://localhost:$PORT"
9289

9390
# Loop through frontend-app-* repos
9491
find "$DEVSTACK_WORKSPACE" -type d -name "frontend-app-*" | while read -r repo; do
@@ -105,4 +102,4 @@ find "$DEVSTACK_WORKSPACE" -type d -name "frontend-app-*" | while read -r repo;
105102
fi
106103
rm -f "$ENV_FILE.bak"
107104
fi
108-
done
105+
done

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ services:
11261126
aliases:
11271127
- edx.devstack.frontend-app-learning
11281128
ports:
1129-
- "${LEARNING_MICROFRONTEND_PORT}:${LEARNING_MICROFRONTEND_PORT}"
1129+
- "${LEARNING_MICROFRONTEND_PORT:-2010}:${LEARNING_MICROFRONTEND_PORT:-2010}"
11301130
depends_on:
11311131
- lms
11321132

py_configuration_files/course_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'http://localhost:1991', # frontend-app-admin-portal
2020
'http://localhost:18400', # frontend-app-publisher
2121
'http://localhost:18450', # frontend-app-support-tools
22-
os.environ.get('LEARNING_MICROFRONTEND_URL', 'http://localhost:2010'), # frontend-app-learning
22+
'http://localhost:' + os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010'), # frontend-app-learning
2323
)
2424

2525
ELASTICSEARCH_DSL['default']['hosts'] = 'edx.devstack.elasticsearch710:9200'

py_configuration_files/ecommerce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'http://localhost:1997', # Account MFE
5858
'http://localhost:1998',
5959
'http://localhost:8734', # Enterprise Learner Portal MFE
60-
os.environ.get('LEARNING_MICROFRONTEND_URL', 'http://localhost:2010'), # Learning MFE
60+
'http://localhost:' + os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010'), # Learning MFE
6161
)
6262
CORS_ALLOW_HEADERS = corsheaders_default_headers + (
6363
'use-jwt-cookie',

py_configuration_files/enterprise_subsidy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from enterprise_subsidy.settings.local import *
23

34
CORS_ORIGIN_WHITELIST = (
@@ -54,6 +55,9 @@
5455
'BACKEND_SERVICE_EDX_OAUTH2_SECRET', 'enterprise-subsidy-backend-service-secret'
5556
)
5657

58+
# This port is configured centrally in devcontainer.json
59+
LEARNING_MICROFRONTEND_PORT = os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010')
60+
5761
JWT_AUTH.update({
5862
'JWT_SECRET_KEY': 'lms-secret',
5963
'JWT_ISSUER': 'http://localhost:18000/oauth2',
@@ -75,7 +79,7 @@
7579
LMS_URL = 'http://edx.devstack.lms:18000'
7680
ENTERPRISE_CATALOG_URL = 'http://edx.devstack.enterprise-catalog:18160'
7781
ENTERPRISE_SUBSIDY_URL = 'http://localhost:18280'
78-
FRONTEND_APP_LEARNING_URL = os.environ.get('LEARNING_MICROFRONTEND_URL', 'http://localhost:2010')
82+
FRONTEND_APP_LEARNING_URL = 'http://localhost:' + LEARNING_MICROFRONTEND_PORT
7983

8084
# Kafka Settings
8185
# "Standard" Kafka settings as defined in https://github.com/openedx/event-bus-kafka/tree/main

py_configuration_files/lms.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
269269
ENTERPRISE_LEARNER_PORTAL_NETLOC = 'localhost:8734'
270270
ENTERPRISE_LEARNER_PORTAL_BASE_URL = 'http://' + ENTERPRISE_LEARNER_PORTAL_NETLOC
271271

272+
########################## LEARNING MICROFRONTEND ##############################
273+
LEARNING_MICROFRONTEND_PORT = os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010')
274+
LEARNING_MICROFRONTEND_NETLOC = 'localhost:' + LEARNING_MICROFRONTEND_PORT
275+
272276
########################## ENTERPRISE ADMIN PORTAL ##############################
273277
ENTERPRISE_ADMIN_PORTAL_NETLOC = 'localhost:1991'
274278
ENTERPRISE_ADMIN_PORTAL_BASE_URL = 'http://' + ENTERPRISE_ADMIN_PORTAL_NETLOC
@@ -312,10 +316,10 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
312316
'localhost:18400', # frontend-app-publisher
313317
'localhost:1993', # frontend-app-ora-grading
314318
'localhost:1996', # frontend-app-learner-dashboard
315-
LEARNING_MICROFRONTEND_NETLOC, # frontend-app-learning
316319
ENTERPRISE_LEARNER_PORTAL_NETLOC, # frontend-app-learner-portal-enterprise
317320
ENTERPRISE_ADMIN_PORTAL_NETLOC, # frontend-app-admin-portal
318321
ENTERPRISE_CHECKOUT_NETLOC, # frontend-app-enterprise-checkout
322+
LEARNING_MICROFRONTEND_NETLOC, # frontend-app-learning
319323
])
320324

321325
###################### JWTs ######################
@@ -386,7 +390,7 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
386390
EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service'
387391

388392
############## Settings for Microfrontends #########################
389-
LEARNING_MICROFRONTEND_URL = os.environ.get('LEARNING_MICROFRONTEND_URL', 'http://localhost:2010')
393+
LEARNING_MICROFRONTEND_URL = 'http://localhost:' + LEARNING_MICROFRONTEND_PORT
390394
ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997'
391395
PROFILE_MICROFRONTEND_URL = 'http://localhost:1995'
392396
COMMUNICATIONS_MICROFRONTEND_URL = 'http://localhost:1984'
@@ -546,7 +550,6 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
546550

547551
# MFEs that will call this service in devstack
548552
CSRF_TRUSTED_ORIGINS = [
549-
LEARNING_MICROFRONTEND_URL, # frontend-app-learning
550553
'http://localhost:2001', # frontend-app-course-authoring
551554
'http://localhost:1997', # frontend-app-account
552555
'http://localhost:1995', # frontend-app-profile
@@ -559,6 +562,7 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
559562
'http://localhost:18450', # frontend-app-support-tools
560563
'http://localhost:1994', # frontend-app-gradebook
561564
'http://localhost:1996', # frontend-app-learner-dashboard
565+
LEARNING_MICROFRONTEND_URL # frontend-app-learning
562566
]
563567

564568
############################ Codejail ############################

0 commit comments

Comments
 (0)