fix: make vite proxy target configurable via environment variable#104
Open
nil957 wants to merge 1 commit into666ghj:mainfrom
Open
fix: make vite proxy target configurable via environment variable#104nil957 wants to merge 1 commit into666ghj:mainfrom
nil957 wants to merge 1 commit into666ghj:mainfrom
Conversation
Changes: - Update vite.config.js to read VITE_API_BASE_URL from environment - Add VITE_API_BASE_URL documentation to .env.example This allows users to configure the backend API URL without modifying the source code, which is especially useful for: - Docker deployments with custom port mappings - Remote server deployments - Development with backend running on a different host The api/index.js already supports VITE_API_BASE_URL, this change ensures the vite dev server proxy is also configurable. Closes 666ghj#93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses issue #93 -
frontend/src/api/index.js中的baseURL不应该硬编码Problem
While
api/index.jsalready supportsVITE_API_BASE_URL, the vite dev server proxy invite.config.jswas still hardcoded tohttp://localhost:5001, causing issues when:Changes
vite.config.jsto readVITE_API_BASE_URLfrom environment variables.env.examplefor the new configuration optionUsage
# In .env file VITE_API_BASE_URL=http://your-backend-host:5001If not set, it defaults to
http://localhost:5001for backward compatibility.Closes #93