Describe the bug
The VITE_BACKEND_URL environment variable is evaluated at compile time, meaning it cannot be set unless the docker image is manually built in an environment with the environment set.
To Reproduce
- Run
docker run --rm -p 3024:80 -e VITE_BACKEND_URL=https://example.com --name drawdb-test ghcr.io/drawdb-io/drawdb:latest
- Navigate to
http://localhost:3024/editor/
- Open browser dev-tools
- Click on Share
- Notice that it tries to make a POST request to
http://localhost:3024/editor/diagrams/undefined/gists (undefined because VITE_BACKEND_URL resolved to undefined during build-time)
Expected behavior
VITE_BACKEND_URL should be correctly evaluated (in this case https://example.com) instead of being evaluated as undefined or as whatever value existed for it during compile-time
Desktop (please complete the following information):
- OS: GNU/Linux
- Browser Floorp 12.14.2@151.0
Additional context
import.meta.env.VITE_BACKEND_URL is evaluated at build-time.
https://vite.dev/guide/env-and-mode#node-env-and-modes
Describe the bug
The
VITE_BACKEND_URLenvironment variable is evaluated at compile time, meaning it cannot be set unless the docker image is manually built in an environment with the environment set.To Reproduce
docker run --rm -p 3024:80 -e VITE_BACKEND_URL=https://example.com --name drawdb-test ghcr.io/drawdb-io/drawdb:latesthttp://localhost:3024/editor/http://localhost:3024/editor/diagrams/undefined/gists(undefined because VITE_BACKEND_URL resolved to undefined during build-time)Expected behavior
VITE_BACKEND_URL should be correctly evaluated (in this case
https://example.com) instead of being evaluated asundefinedor as whatever value existed for it during compile-timeDesktop (please complete the following information):
Additional context
import.meta.env.VITE_BACKEND_URLis evaluated at build-time.https://vite.dev/guide/env-and-mode#node-env-and-modes