Skip to content

Commit

Permalink
fix REPL base url to allow hosting it on proxy environemnts (#3169)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey authored May 21, 2024
1 parent 3f958a1 commit 61d0311
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/many-terms-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@finos/legend-application-repl-deployment': patch
'@finos/legend-application-repl': patch
---

BugFix REPL base url
5 changes: 3 additions & 2 deletions packages/legend-application-repl-deployment/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

import { LegendREPLGridClientWebApplication } from '@finos/legend-application-repl';
import config from '../repl.config.js';
import './index.scss';

LegendREPLGridClientWebApplication.run(config.baseUrl);
// Resolve baseUrl relatively for application to work in vscode code-server
const relativeBaseUrl = new URL('./', window.location.href).pathname;
LegendREPLGridClientWebApplication.run(relativeBaseUrl);
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ export class LegendREPLGridClient extends LegendApplication {
baseUrl: string,
): Promise<[LegendApplicationConfig, ExtensionsConfigurationData]> {
const client = new NetworkClient();
// Resolve baseUrl relatively for application to work in vscode code-server
const relativeBaseUrl = new URL('./', window.location.href).pathname;
// app config
let configData: LegendREPLGridClientApplicationConfigData | undefined;
try {
configData = await client.get<LegendREPLGridClientApplicationConfigData>(
`${window.location.origin}${relativeBaseUrl}config.json`,
`${window.location.origin}${baseUrl}config.json`,
);
} catch (error) {
assertErrorThrown(error);
Expand All @@ -85,7 +83,7 @@ export class LegendREPLGridClient extends LegendApplication {
let versionData;
try {
versionData = await client.get<LegendApplicationVersionData>(
`${window.location.origin}${relativeBaseUrl}version.json`,
`${window.location.origin}${baseUrl}version.json`,
);
} catch (error) {
assertErrorThrown(error);
Expand Down

0 comments on commit 61d0311

Please sign in to comment.