From 925b25b65cf740ec33fe93250d850a35afeed3ac Mon Sep 17 00:00:00 2001 From: Max Bischof Date: Wed, 11 Dec 2024 11:50:30 +0100 Subject: [PATCH] Remove unecessary config handling --- .../templates/tldraw-client-configmap.yml.j2 | 1 - src/configuration/api/api.configuration.ts | 35 +------------------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/ansible/roles/tldraw-client-core/templates/tldraw-client-configmap.yml.j2 b/ansible/roles/tldraw-client-core/templates/tldraw-client-configmap.yml.j2 index ba1767f..a0f6448 100644 --- a/ansible/roles/tldraw-client-core/templates/tldraw-client-configmap.yml.j2 +++ b/ansible/roles/tldraw-client-core/templates/tldraw-client-configmap.yml.j2 @@ -9,4 +9,3 @@ data: NODE_ENV: "production" TZ: "Europe/Berlin" PORT: "3046" - CONFIG_PATH: "/api/v3/config/public" diff --git a/src/configuration/api/api.configuration.ts b/src/configuration/api/api.configuration.ts index 41d7ac3..ba790da 100644 --- a/src/configuration/api/api.configuration.ts +++ b/src/configuration/api/api.configuration.ts @@ -1,41 +1,8 @@ -// remove this code by BC-7906 -// set CONFIG_PATH to /api/tldraw/config/public -// remove line 7 and 8 in ngnix.conf.template -import { HttpStatusCode } from "../../types/StatusCodeEnums"; -import { setErrorData } from "../../utils/errorData"; -import { redirectToErrorPage } from "../../utils/redirectUtils"; - -const getConfigOptions = async (): Promise<{ - CONFIG_PATH: string; -}> => { - const connectionOptions = { - CONFIG_PATH: `/api/tldraw/config/public`, - }; - - if (import.meta.env.PROD) { - try { - const response = await fetch("/tldraw-client-runtime.config.json"); - - if (!response.ok) { - throw new Error(`${response.status} - ${response.statusText}`); - } - - const data: { CONFIG_PATH: string } = await response.json(); - connectionOptions.CONFIG_PATH = data.CONFIG_PATH; - } catch (error) { - setErrorData(HttpStatusCode.InternalServerError, "error.500"); - redirectToErrorPage(); - } - } - - return connectionOptions; -}; - export const API = { FILE_UPLOAD: "/api/v3/file/upload/school/SCHOOLID/boardnodes/CONTEXTID", FILE_DELETE: "/api/v3/file/delete/FILERECORD_ID", FILE_RESTORE: "/api/v3/file/restore/FILERECORD_ID", LOGIN_REDIRECT: "/login?redirect=/tldraw?parentId=PARENTID", USER_DATA: `/api/v3/user/me`, - CONFIG_PATH: await getConfigOptions().then((options) => options.CONFIG_PATH), + CONFIG_PATH: `/api/tldraw/config/public`, };