fix: vite proxy 支持 VITE_API_PROXY 环境变量覆盖

不再硬编码端口,通过 systemd Environment=VITE_API_PROXY=xxx 注入
默认值仍为 18080(兼容原始配置)
This commit is contained in:
2026-06-01 11:44:42 +08:00
parent f4ba8028fb
commit 810336f989

View File

@@ -40,7 +40,7 @@ export default defineConfig(({ mode, command }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://localhost:18082/openhis',
target: process.env.VITE_API_PROXY || 'http://localhost:18080/openhis',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, ''),
},