diff options
Diffstat (limited to 'subprojects/frontend')
-rw-r--r-- | subprojects/frontend/config/detectDevModeOptions.ts | 4 | ||||
-rw-r--r-- | subprojects/frontend/src/xtext/BackendConfig.ts | 2 | ||||
-rw-r--r-- | subprojects/frontend/src/xtext/XtextWebSocketClient.ts | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/subprojects/frontend/config/detectDevModeOptions.ts b/subprojects/frontend/config/detectDevModeOptions.ts index 665204dc..6052e047 100644 --- a/subprojects/frontend/config/detectDevModeOptions.ts +++ b/subprojects/frontend/config/detectDevModeOptions.ts | |||
@@ -30,8 +30,8 @@ function detectListenOptions( | |||
30 | fallbackHost: string, | 30 | fallbackHost: string, |
31 | fallbackPort: number, | 31 | fallbackPort: number, |
32 | ): ListenOptions { | 32 | ): ListenOptions { |
33 | const host = process.env[`${name}_HOST`] ?? fallbackHost; | 33 | const host = process.env[`REFINERY_${name}_HOST`] ?? fallbackHost; |
34 | const rawPort = process.env[`${name}_PORT`]; | 34 | const rawPort = process.env[`REFINERY_${name}_PORT`]; |
35 | const port = rawPort === undefined ? fallbackPort : parseInt(rawPort, 10); | 35 | const port = rawPort === undefined ? fallbackPort : parseInt(rawPort, 10); |
36 | const secure = port === 443; | 36 | const secure = port === 443; |
37 | return { host, port, secure }; | 37 | return { host, port, secure }; |
diff --git a/subprojects/frontend/src/xtext/BackendConfig.ts b/subprojects/frontend/src/xtext/BackendConfig.ts index 4c7eac5f..e7043bd5 100644 --- a/subprojects/frontend/src/xtext/BackendConfig.ts +++ b/subprojects/frontend/src/xtext/BackendConfig.ts | |||
@@ -11,7 +11,7 @@ import { z } from 'zod'; | |||
11 | export const ENDPOINT = 'config.json'; | 11 | export const ENDPOINT = 'config.json'; |
12 | 12 | ||
13 | const BackendConfig = z.object({ | 13 | const BackendConfig = z.object({ |
14 | webSocketURL: z.string().url(), | 14 | webSocketURL: z.string().url().optional(), |
15 | }); | 15 | }); |
16 | 16 | ||
17 | type BackendConfig = z.infer<typeof BackendConfig>; | 17 | type BackendConfig = z.infer<typeof BackendConfig>; |
diff --git a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts index 6bb7eec8..963c1d4c 100644 --- a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts +++ b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts | |||
@@ -282,7 +282,10 @@ export default class XtextWebSocketClient { | |||
282 | log.debug('Creating WebSocket'); | 282 | log.debug('Creating WebSocket'); |
283 | 283 | ||
284 | (async () => { | 284 | (async () => { |
285 | const { webSocketURL } = await fetchBackendConfig(); | 285 | let { webSocketURL } = await fetchBackendConfig(); |
286 | if (webSocketURL === undefined) { | ||
287 | webSocketURL = `${window.origin.replace(/^http/, 'ws')}/xtext-service`; | ||
288 | } | ||
286 | this.openWebSocketWithURL(webSocketURL); | 289 | this.openWebSocketWithURL(webSocketURL); |
287 | })().catch((error) => { | 290 | })().catch((error) => { |
288 | log.error('Error while initializing connection', error); | 291 | log.error('Error while initializing connection', error); |