From 3101fd7ef95ff5c58dc40cf3e9b7e566dcf93577 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Fri, 09 Sep 2022 22:05:10 +0100 Subject: [PATCH] Fix CHARTERED_WEB_URL environment variable so it's picked up by Vite --- chartered-frontend/Dockerfile | 4 +++- chartered-frontend/README.md | 2 +- chartered-frontend/src/stores/auth.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chartered-frontend/Dockerfile b/chartered-frontend/Dockerfile index 6d0a825..de0b066 100644 --- a/chartered-frontend/Dockerfile +++ a/chartered-frontend/Dockerfile @@ -1,6 +1,6 @@ FROM node AS builder -ARG CHARTERED_WEB_URL -RUN ["/bin/bash", "-c", ": ${CHARTERED_WEB_URL:?CHARTERED_WEB_URL must be set to the public URL that chartered-web can be reached by passing --build-arg to docker build.}"] +ARG VITE_CHARTERED_WEB_URL +RUN ["/bin/bash", "-c", ": ${VITE_CHARTERED_WEB_URL:?VITE_CHARTERED_WEB_URL must be set to the public URL that chartered-web can be reached by passing --build-arg to docker build.}"] WORKDIR /app COPY . /app RUN npm install -D && npm run build diff --git a/chartered-frontend/README.md b/chartered-frontend/README.md index 860d947..fcf7d98 100644 --- a/chartered-frontend/README.md +++ a/chartered-frontend/README.md @@ -19,5 +19,5 @@ To create a production version of chartered-frontend: ```bash -docker build . --build-arg CHARTERED_WEB_URL=http://127.0.0.1:3000 +docker build . --build-arg VITE_CHARTERED_WEB_URL=http://127.0.0.1:3000 ``` diff --git a/chartered-frontend/src/stores/auth.ts b/chartered-frontend/src/stores/auth.ts index 6b80621..15474d5 100644 --- a/chartered-frontend/src/stores/auth.ts +++ a/chartered-frontend/src/stores/auth.ts @@ -5,7 +5,7 @@ /** * The base URL of the chartered-web instance */ -export const BASE_URL = import.meta.env.CHARTERED_WEB_URL || 'http://127.0.0.1:8888'; +export const BASE_URL = import.meta.env.VITE_CHARTERED_WEB_URL || 'http://127.0.0.1:8888'; /** * Key in localStorage to store authentication information in -- rgit 0.1.3