mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-25 17:42:24 +08:00
Use different API route according the ENV (#13597)
### What problem does this PR solve? 1. Fix go server date precision 2. Use API_SCHEME_PROXY to control the web API route ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -30,6 +30,83 @@ const inspectorBabelPlugin = (): import('vite').Plugin => ({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '');
|
||||
|
||||
const proxySchemes = {
|
||||
python: {
|
||||
'/api/v1/admin': {
|
||||
target: 'http://127.0.0.1:9381/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/v1': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
hybrid: {
|
||||
'/v1/system/config': {
|
||||
target: 'http://127.0.0.1:9384/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/v1/user/login': {
|
||||
target: 'http://127.0.0.1:9384/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/v1/user/logout': {
|
||||
target: 'http://127.0.0.1:9384/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v1/admin/sandbox': {
|
||||
target: 'http://127.0.0.1:9381/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v1/admin': {
|
||||
target: 'http://127.0.0.1:9385/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/v1': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
go: {
|
||||
'/api/v1/admin': {
|
||||
target: 'http://127.0.0.1:9385/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:9384/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/v1': {
|
||||
target: 'http://127.0.0.1:9384/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const proxy =
|
||||
proxySchemes[env.API_PROXY_SCHEME || 'python'] || proxySchemes.python;
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
inspectorBabelPlugin(),
|
||||
@@ -85,38 +162,7 @@ export default defineConfig(({ mode }) => {
|
||||
hmr: {
|
||||
overlay: false,
|
||||
},
|
||||
proxy: {
|
||||
'/api/v1/admin': {
|
||||
target: 'http://127.0.0.1:9381/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
// '/v1/system/config': {
|
||||
// target: 'http://127.0.0.1:9382/',
|
||||
// changeOrigin: true,
|
||||
// ws: true,
|
||||
// },
|
||||
// '/v1/user/login': {
|
||||
// target: 'http://127.0.0.1:9382/',
|
||||
// changeOrigin: true,
|
||||
// ws: true,
|
||||
// },
|
||||
// '/v1/user/logout': {
|
||||
// target: 'http://127.0.0.1:9382/',
|
||||
// changeOrigin: true,
|
||||
// ws: true,
|
||||
// },
|
||||
'/v1': {
|
||||
target: 'http://127.0.0.1:9380/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
proxy,
|
||||
},
|
||||
assetsInclude: ['**/*.md'],
|
||||
base: env.VITE_BASE_URL,
|
||||
|
||||
Reference in New Issue
Block a user