mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
feat(ui): auto proxy backend (#2238)
This commit is contained in:
@@ -4,10 +4,7 @@ export const drawerWidth = 260
|
|||||||
export const appDrawerWidth = 320
|
export const appDrawerWidth = 320
|
||||||
export const headerHeight = 80
|
export const headerHeight = 80
|
||||||
export const maxScroll = 100000
|
export const maxScroll = 100000
|
||||||
export const baseURL =
|
export const baseURL = window.location.origin
|
||||||
import.meta.env.PROD === true
|
|
||||||
? window.location.origin
|
|
||||||
: window.location.origin.replace(`:${import.meta.env.VITE_PORT ?? '8080'}`, ':3000')
|
|
||||||
export const uiBaseURL = window.location.origin
|
export const uiBaseURL = window.location.origin
|
||||||
export const FLOWISE_CREDENTIAL_ID = 'FLOWISE_CREDENTIAL_ID'
|
export const FLOWISE_CREDENTIAL_ID = 'FLOWISE_CREDENTIAL_ID'
|
||||||
export const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db'
|
export const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db'
|
||||||
|
|||||||
+30
-15
@@ -3,21 +3,36 @@ import react from '@vitejs/plugin-react'
|
|||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
|
||||||
dotenv.config()
|
export default defineConfig(async ({ mode }) => {
|
||||||
|
let proxy = undefined
|
||||||
export default defineConfig({
|
if (mode === 'development') {
|
||||||
plugins: [react()],
|
const serverPort = parseInt(dotenv.config({ processEnv: {}, path: '../server/.env' }).parsed?.['PORT'])
|
||||||
resolve: {
|
if (!Number.isNaN(serverPort) && serverPort > 0 && serverPort < 65535) {
|
||||||
alias: {
|
proxy = {
|
||||||
'@': resolve(__dirname, 'src')
|
'/api': {
|
||||||
|
target: `http://localhost:${serverPort}`,
|
||||||
|
changeOrigin: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dotenv.config()
|
||||||
|
return {
|
||||||
|
plugins: [react()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': resolve(__dirname, 'src')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
root: resolve(__dirname),
|
||||||
|
build: {
|
||||||
|
outDir: './build'
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
open: true,
|
||||||
|
proxy,
|
||||||
|
port: process.env.VITE_PORT ?? 8080,
|
||||||
|
host: process.env.VITE_HOST
|
||||||
}
|
}
|
||||||
},
|
|
||||||
root: resolve(__dirname),
|
|
||||||
build: {
|
|
||||||
outDir: './build'
|
|
||||||
},
|
|
||||||
server: {
|
|
||||||
open: true,
|
|
||||||
port: process.env.VITE_PORT ?? 8080
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user