🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2022-09-09 22:05:10.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-09-09 22:05:10.0 +01:00:00
commit
3101fd7ef95ff5c58dc40cf3e9b7e566dcf93577 [patch]
tree
784168d4cc4d3317a0989e90c4b397140c2426b3
parent
cd9f35fdd5729f843ea8904aa848e1b0d03f45af
download
3101fd7ef95ff5c58dc40cf3e9b7e566dcf93577.tar.gz

Fix CHARTERED_WEB_URL environment variable so it's picked up by Vite



Diff

 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