Skip to content

Commit 7fffbb5

Browse files
committed
adding optional override for player's launch url base
1 parent b650497 commit 7fffbb5

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

cts/.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ HOSTNAME=localhost
22

33
PLAYER_ROOT_PATH=/player
44
PLAYER_BASE_URL=http://player:3398/player
5-
PLAYER_CONTENT_URL=http://localhost:3398/player/content
5+
PLAYER_CONTENT_URL=http://localhost/player/content
6+
PLAYER_LAUNCH_URL_BASE=http://localhost/player
67
PLAYER_KEY=cts
78
PLAYER_SECRET=player-secret
89
PLAYER_TOKEN_SECRET=player-token-secret

player/.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ LRS_XAPI_VERSION=1.0.3
1414

1515
## Default is empty, add if necessary for nginx config
1616
PLAYER_API_ROOT=
17+
PLAYER_LAUNCH_URL_BASE=

player/service/package-lock.json

+3-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

player/service/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
"libxmljs": "^0.19.8",
4343
"mysql": "^2.18.1",
4444
"node-stream-zip": "^1.13.6",
45+
"uuid": "^9.0.1",
4546
"wait-port": "^0.2.9"
4647
},
4748
"devDependencies": {
4849
"chai": "^4",
4950
"dotenv": "^16.4.5",
50-
"mocha": "^10.4.0",
51-
"uuid": "^9.0.1"
51+
"mocha": "^10.4.0"
5252
}
5353
}

player/service/plugins/routes/v1/courses.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,6 @@ module.exports = {
730730
moveOn = req.payload.moveOn || courseAu.metadata.moveOn || "NotApplicable",
731731
alternateEntitlementKey = req.payload.alternateEntitlementKey || courseAu.metadata.alternateEntitlementKey,
732732

733-
baseUrl = `${protocol}//${req.url.host}${rootPath}`,
734-
endpoint = `${baseUrl}/lrs`,
735733
sessionId = uuidv4(),
736734
contextTemplate = {
737735
contextActivities: {
@@ -746,6 +744,9 @@ module.exports = {
746744
}
747745
};
748746

747+
let launchURLBase = (process.env.PLAYER_LAUNCH_URL_BASE || `${protocol}//${req.url.host}${rootPath}`);
748+
let endpoint = `${launchURLBase}/lrs`;
749+
749750
// //Debug messages for troubleshooting host and path issuse - MB
750751
// console.log("Base url is ", baseUrl);
751752
// console.log("Which makes endpoint ", endpoint);
@@ -923,7 +924,7 @@ module.exports = {
923924
const launchUrlParams = new URLSearchParams(
924925
{
925926
endpoint,
926-
fetch: `${baseUrl}/fetch-url/${session.id}`,
927+
fetch: `${launchURLBase}/fetch-url/${session.id}`,
927928
actor: JSON.stringify(actor),
928929
activityId: lmsActivityId,
929930
registration: reg.code

0 commit comments

Comments
 (0)