diff --git a/Dockerfile b/Dockerfile index 9db0296..d06a3a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ARG GIT_SHA ENV REACT_APP_GIT_SHA=$GIT_SHA ARG BASE_PATH -ENV PUBLIC_URL=$BASE_PATH +ENV BASE_PATH=$BASE_PATH ARG E2E ENV REACT_APP_E2E=$E2E diff --git a/src/client/Router.tsx b/src/client/Router.tsx index b50a5a8..5f7b224 100644 --- a/src/client/Router.tsx +++ b/src/client/Router.tsx @@ -5,7 +5,7 @@ import ThesesPage from './components/ThesisPage/ThesesPage' import RootBoundary from './components/Errors/RootBoundary' import NotFound from './components/Errors/NotFound' -import { PUBLIC_URL } from '../config' +import { BASE_PATH } from '../config' const router = createBrowserRouter( [ @@ -27,7 +27,7 @@ const router = createBrowserRouter( }, ], { - basename: PUBLIC_URL, + basename: BASE_PATH, } ) diff --git a/src/client/components/ThesisPage/ThesisEditForm.tsx b/src/client/components/ThesisPage/ThesisEditForm.tsx index 0a0c495..cc4fda6 100644 --- a/src/client/components/ThesisPage/ThesisEditForm.tsx +++ b/src/client/components/ThesisPage/ThesisEditForm.tsx @@ -28,6 +28,7 @@ import { useTranslation } from 'react-i18next' import programs from '../mockPorgrams' import SupervisorSelect from './SupervisorSelect' import useUsers from '../../hooks/useUsers' +import { BASE_PATH } from '../../../config' const VisuallyHiddenInput = styled('input')({ clip: 'rect(0 0 0 0)', @@ -231,7 +232,7 @@ const ThesisEditForm: React.FC<{ label={ 'filename' in editedThesis.researchPlan ? ( {editedThesis.researchPlan.name} @@ -274,7 +275,7 @@ const ThesisEditForm: React.FC<{ label={ 'filename' in editedThesis.waysOfWorking ? ( {editedThesis.waysOfWorking.name} diff --git a/src/client/util/apiClient.tsx b/src/client/util/apiClient.tsx index 5bc4b01..994cfc5 100644 --- a/src/client/util/apiClient.tsx +++ b/src/client/util/apiClient.tsx @@ -1,8 +1,8 @@ import axios from 'axios' -import { PUBLIC_URL } from '../../config' +import { BASE_PATH } from '../../config' -const baseURL = `${PUBLIC_URL}/api` +const baseURL = `${BASE_PATH}/api` const apiClient = axios.create({ baseURL }) diff --git a/src/config.ts b/src/config.ts index d2b215e..d15dfad 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,7 +8,7 @@ export const inE2EMode = process.env.REACT_APP_E2E === 'true' export const GIT_SHA = process.env.REACT_APP_GIT_SHA || '' -export const PUBLIC_URL = process.env.PUBLIC_URL || '' +export const BASE_PATH = process.env.BASE_PATH || '' // eslint-disable-next-line no-nested-ternary export const FULL_URL = inProduction diff --git a/src/server/routes/login.ts b/src/server/routes/login.ts index af7e742..0428a61 100644 --- a/src/server/routes/login.ts +++ b/src/server/routes/login.ts @@ -1,7 +1,7 @@ import express from 'express' import passport from 'passport' -import { PUBLIC_URL } from '../../config' +import { BASE_PATH } from '../../config' const loginRouter = express.Router() @@ -9,9 +9,9 @@ loginRouter.get('/', passport.authenticate('oidc')) loginRouter.get( '/callback', - passport.authenticate('oidc', { failureRedirect: PUBLIC_URL || '/' }), + passport.authenticate('oidc', { failureRedirect: BASE_PATH || '/' }), (_, res) => { - res.redirect(PUBLIC_URL || '/') + res.redirect(BASE_PATH || '/') } )