From 7f39d0e37dd3c7b9e16e16272afacd508c6da2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lys=C3=A6?= <101974839+ElysaSrc@users.noreply.github.com> Date: Wed, 3 Jan 2024 10:44:04 +0100 Subject: [PATCH] front: use browser relative path instead of env domain --- docker/gateway-entrypoint.sh | 1 - front/.env.example | 1 - front/.env.local.defaults | 1 - front/src/common/Map/Layers/blankStyle.ts | 2 +- front/src/config/config.ts | 4 ++-- front/src/vite-env.d.ts | 1 - 6 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docker/gateway-entrypoint.sh b/docker/gateway-entrypoint.sh index 86dafb5b2fa..396f1326fa1 100644 --- a/docker/gateway-entrypoint.sh +++ b/docker/gateway-entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/sh >/tmp/front_config jq -rn '{ - OSRD_BACKEND_URL: env.OSRD_BACKEND_URL, OSRD_SENTRY_DSN: env.OSRD_SENTRY_DSN, OSRD_SENTRY_ENVIRONMENT: env.OSRD_SENTRY_ENVIRONMENT, OSRD_GIT_DESCRIBE: env.OSRD_GIT_DESCRIBE, diff --git a/front/.env.example b/front/.env.example index 3988d84a732..2d74683071e 100644 --- a/front/.env.example +++ b/front/.env.example @@ -1,4 +1,3 @@ -OSRD_BACKEND_URL=http://example.com/api OSRD_SENTRY_DSN=https://key@sentry.example.com/42 OSRD_SENTRY_ENVIRONMENT=staging OSRD_GIT_DESCRIBE=xxxxxx diff --git a/front/.env.local.defaults b/front/.env.local.defaults index 0edb902db7b..b3eed88091d 100644 --- a/front/.env.local.defaults +++ b/front/.env.local.defaults @@ -1,4 +1,3 @@ -OSRD_BACKEND_URL=http://localhost:4000 OSRD_SENTRY_DSN= OSRD_SENTRY_ENVIRONMENT= OSRD_GIT_DESCRIBE= diff --git a/front/src/common/Map/Layers/blankStyle.ts b/front/src/common/Map/Layers/blankStyle.ts index 951f3f8c81e..0c5c897204b 100644 --- a/front/src/common/Map/Layers/blankStyle.ts +++ b/front/src/common/Map/Layers/blankStyle.ts @@ -14,7 +14,7 @@ export const useMapBlankStyle = (): MapProps['mapStyle'] => { ? [ { url: 'https://static.osm.osrd.fr/sprites/sprites', id: 'default' }, ...signalingSystems.map((id) => ({ - url: `${baseURL}/sprites/${id}/sprites`, + url: `${window.location.origin}${baseURL}/sprites/${id}/sprites`, id, })), ] diff --git a/front/src/config/config.ts b/front/src/config/config.ts index fb7817330aa..8d62067e71f 100644 --- a/front/src/config/config.ts +++ b/front/src/config/config.ts @@ -1,6 +1,6 @@ export const MAIN_API = { - proxy_editoast: `${import.meta.env.OSRD_BACKEND_URL}/api`, - proxy_gateway: `${import.meta.env.OSRD_BACKEND_URL}`, + proxy_editoast: '/api', + proxy_gateway: '', version: '0.0.1', editor: { component_identifier: { database: 'gaia', name: 'Test' }, diff --git a/front/src/vite-env.d.ts b/front/src/vite-env.d.ts index ef4f6a75480..5470568b536 100644 --- a/front/src/vite-env.d.ts +++ b/front/src/vite-env.d.ts @@ -1,7 +1,6 @@ /// interface ImportMetaEnv { - OSRD_BACKEND_URL: string; OSRD_SENTRY_DSN: string; OSRD_SENTRY_ENVIRONMENT: string; OSRD_GIT_DESCRIBE: string;