mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Move proxy url to env file
This commit is contained in:
parent
487d73d643
commit
63cc555e21
1
ui/.env.development
Normal file
1
ui/.env.development
Normal file
@ -0,0 +1 @@
|
|||||||
|
VITE_PROXY_URL='localhost:8001'
|
@ -51,7 +51,7 @@ function connect() {
|
|||||||
|
|
||||||
active.value = true
|
active.value = true
|
||||||
let protocol = (location.protocol === "https:") ? "wss://" : "ws://";
|
let protocol = (location.protocol === "https:") ? "wss://" : "ws://";
|
||||||
let host = import.meta.env.DEV ? 'localhost:8001' : location.host;
|
let host = import.meta.env.DEV ? import.meta.env.VITE_PROXY_URL : location.host;
|
||||||
let cmd = encodeURIComponent(command.value)
|
let cmd = encodeURIComponent(command.value)
|
||||||
socket = new WebSocket(`${protocol}${host}/api/container/connect?token=${store.state.user.token}&node=${props.node}&id=${props.id}&cmd=${cmd}`);
|
socket = new WebSocket(`${protocol}${host}/api/container/connect?token=${store.state.user.token}&node=${props.node}&id=${props.id}&cmd=${cmd}`);
|
||||||
socket.onopen = () => {
|
socket.onopen = () => {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig, loadEnv } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
|
const config = loadEnv('development', './')
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
@ -28,7 +30,7 @@ export default defineConfig({
|
|||||||
port: 3002,
|
port: 3002,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8001',
|
target: 'http://' + config.VITE_PROXY_URL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user