mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
fix: use environment to select API_ENDPOINT
This commit is contained in:
1 parent
c248004484
commit
d86aa5bcc1
3 files changed
+8
-5
No files matched your search
+2
-1
@@ -4,7 +4,8 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "API_TARGET=https://odyssey.wancat.cc vite",
|
||||
"dev:local": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
||||
+5
-4
@@ -7,12 +7,13 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:3000/api/v1',
|
||||
rewrite: (path) => path.replace(/^\/api/, ''), // Optional: remove "/api" prefix from the path
|
||||
target: `${process.env.API_TARGET || 'http://localhost:3000'}/api/v1`,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
'/socket.io': {
|
||||
target: 'ws://localhost:3000',
|
||||
// target: 'wss://odyssey.wancat.cc',
|
||||
target: process.env.API_TARGET || 'ws://localhost:3000',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"app": "yarn workspace app dev",
|
||||
"app:local": "yarn workspace app dev:local",
|
||||
"server": "yarn workspace server dev",
|
||||
"cli": "yarn workspace client start",
|
||||
"lint": "eslint --ext .js,.vue .",
|
||||
|
||||
Reference in new issue
Block a user