Skip to content

[BUG] Cannot change backend URL when using docker image #1025

Description

@x3rt

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

  1. Run docker run --rm -p 3024:80 -e VITE_BACKEND_URL=https://example.com --name drawdb-test ghcr.io/drawdb-io/drawdb:latest
  2. Navigate to http://localhost:3024/editor/
  3. Open browser dev-tools
  4. Click on Share
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions