From 5eba160aa5bea6d3224f241e7a248e8f41ccce01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20D=C3=B6rre?= Date: Sun, 18 Apr 2021 11:58:29 +0200 Subject: [PATCH] allow external configuration --- front/dist/index.tmpl.html | 1 + front/src/Enum/EnvironmentVariable.ts | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index 187e513a..3c40f38b 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -94,6 +94,7 @@ + diff --git a/front/src/Enum/EnvironmentVariable.ts b/front/src/Enum/EnvironmentVariable.ts index 163489bb..0bb6145a 100644 --- a/front/src/Enum/EnvironmentVariable.ts +++ b/front/src/Enum/EnvironmentVariable.ts @@ -1,16 +1,22 @@ +declare global { + interface Window { + waconfig:any; + } +} + const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true"; const START_ROOM_URL: string = - process.env.START_ROOM_URL || "/_/global/maps.workadventure.localhost/Floor1/floor1.json"; -const PUSHER_URL = process.env.PUSHER_URL || "//pusher.workadventure.localhost"; + process.env.START_ROOM_URL || window.waconfig.START_ROOM_URL || "/_/global/maps.workadventure.localhost/Floor1/floor1.json"; +const PUSHER_URL = process.env.PUSHER_URL || window.waconfig.PUSHER_URL || "//pusher.workadventure.localhost"; export const ADMIN_URL = process.env.ADMIN_URL || "//workadventu.re"; const UPLOADER_URL = process.env.UPLOADER_URL || "//uploader.workadventure.localhost"; -const STUN_SERVER: string = process.env.STUN_SERVER || "stun:stun.l.google.com:19302"; -const TURN_SERVER: string = process.env.TURN_SERVER || ""; +const STUN_SERVER: string = process.env.STUN_SERVER || window.waconfig.STUN_SERVER || "stun:stun.l.google.com:19302"; +const TURN_SERVER: string = process.env.TURN_SERVER || window.waconfig.TURN_SERVER || ""; const SKIP_RENDER_OPTIMIZATIONS: boolean = process.env.SKIP_RENDER_OPTIMIZATIONS == "true"; const DISABLE_NOTIFICATIONS: boolean = process.env.DISABLE_NOTIFICATIONS == "true"; const TURN_USER: string = process.env.TURN_USER || ""; const TURN_PASSWORD: string = process.env.TURN_PASSWORD || ""; -const JITSI_URL: string | undefined = process.env.JITSI_URL === "" ? undefined : process.env.JITSI_URL; +const JITSI_URL: string | undefined = (process.env.JITSI_URL === "" || process.env.JITSI_URL === null) ? window.waconfig.JITSI_URL : process.env.JITSI_URL; const JITSI_PRIVATE_MODE: boolean = process.env.JITSI_PRIVATE_MODE == "true"; const POSITION_DELAY = 200; // Wait 200ms between sending position events const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new movement is sent by the player