Changeset View
Changeset View
Standalone View
Standalone View
web/app/vite.config.js
| import { fileURLToPath, URL } from 'url' | import { fileURLToPath, URL } from 'url' | ||||
| import { defineConfig } from 'vite' | import { defineConfig, loadEnv } from 'vite' | ||||
| import vue from '@vitejs/plugin-vue' | import vue from '@vitejs/plugin-vue' | ||||
| import process from 'node:process' | |||||
| // https://vitejs.dev/config/ | // https://vitejs.dev/config/ | ||||
| export default defineConfig({ | export default ({ mode }) => { | ||||
| const env = loadEnv(mode, process.cwd()); | |||||
| const backendUrl = env.VITE_DEV_SERVER_BACKEND_URL ?? 'http://localhost:8080' | |||||
sybren: I think the `??` here (and below) should be `||`. In other words, when the environment… | |||||
| const isHttps = env.VITE_DEV_SERVER_HTTPS === 'true' | |||||
| const host = env.VITE_DEV_SERVER_HOST ?? 'localhost' | |||||
| return defineConfig({ | |||||
| plugins: [vue()], | plugins: [vue()], | ||||
| resolve: { | resolve: { | ||||
| alias: { | alias: { | ||||
| '@': fileURLToPath(new URL('./src', import.meta.url)) | '@': fileURLToPath(new URL('./src', import.meta.url)) | ||||
| } | |||||
| }, | }, | ||||
| }, | |||||
| server: { | |||||
| https: isHttps, | |||||
Not Done Inline Actionsis_https would be a better constant name. It'll make it easier to understand when you (like me) criss-cross through the code, without carefully reading the assignment. sybren: `is_https` would be a better constant name. It'll make it easier to understand when you (like… | |||||
Done Inline Actionsgood point, i agree jan_thoma: good point, i agree | |||||
| host: host, | |||||
| proxy: { | |||||
| '/api': { | |||||
| target: backendUrl, | |||||
| changeOrigin: true, | |||||
| secure: false, | |||||
| }, | |||||
| '/socket.io': { | |||||
| target: backendUrl, | |||||
| changeOrigin: true, | |||||
| secure: true, | |||||
| ws: true, | |||||
| }, | |||||
| '/job-files': { | |||||
| target: backendUrl, | |||||
| changeOrigin: true, | |||||
| secure: false, | |||||
| }, | |||||
| '/flamenco3-addon.zip': { | |||||
| target: backendUrl, | |||||
| changeOrigin: true, | |||||
| secure: false, | |||||
| } | |||||
| } | |||||
| } | |||||
| }) | }) | ||||
| } | |||||
I think the ?? here (and below) should be ||. In other words, when the environment variables exist but are empty, I think it would be better if they'd be ignored. Let me know if you don't agree.