Add: use env proxy target vars

This commit is contained in:
Aroy-Art 2025-04-04 09:39:51 +02:00
parent 510fff3059
commit 11911efe35
Signed by: Aroy
GPG key ID: 583642324A1D2070
2 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View file

@ -341,3 +341,4 @@ dump.rdb
# Folders
tmp/
backend/media/
media/

View file

@ -2,6 +2,9 @@ import path from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
const proxyTargetAPI = process.env.VITE_PROXY_TARGET_API || 'http://localhost:8080';
const proxyTargetMedia = process.env.VITE_PROXY_TARGET_MEDIA || proxyTargetAPI;
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
@ -13,12 +16,12 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
target: proxyTargetAPI,
changeOrigin: true,
secure: false,
},
'/media': {
target: 'http://localhost:8080',
target: proxyTargetMedia,
changeOrigin: true,
secure: false,
},