From 329c4c46752b36dd43878f4f5cd2b8f889268ab4 Mon Sep 17 00:00:00 2001 From: Donkie Date: Sun, 14 May 2023 20:21:25 +0200 Subject: [PATCH] Client: Don't hard code the API endpoint anymore --- Dockerfile | 2 ++ client/src/App.tsx | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ff1a89a..3414b86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM node:16-alpine as client-builder COPY ./client /client WORKDIR /client RUN npm install + +RUN echo "VITE_APIURL=/api/v1" > .env.production RUN npm run build FROM python:3.11-alpine as runner diff --git a/client/src/App.tsx b/client/src/App.tsx index 030af1e..9d3e6fc 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -43,12 +43,24 @@ function App() { getLocale: () => i18n.language, }; + if (!import.meta.env.VITE_APIURL) { + return ( + <> +

Missing API URL

+

+ App was built without an API URL. Please set the VITE_APIURL + environment variable to the URL of your Spoolman API. +

+ + ); + } + return (