fix(fix3): runtime env hardening and public endpoint source-of-truth
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
|
||||
import { ConfigEnv, defineConfig, loadEnv, UserConfig } from "vite";
|
||||
import { defineConfig, UserConfig } from "vite";
|
||||
|
||||
import AutoImport from "unplugin-auto-import/vite";
|
||||
import Components from "unplugin-vue-components/vite";
|
||||
@@ -20,9 +20,10 @@ const pathSrc = path.resolve(__dirname, "src");
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g;
|
||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||
const DEV_SERVER_PORT = 8080;
|
||||
const API_BASE = "/hui";
|
||||
|
||||
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
export default defineConfig((): UserConfig => {
|
||||
return {
|
||||
base: "/",
|
||||
resolve: {
|
||||
@@ -44,11 +45,11 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
},
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: Number(env.VITE_APP_PORT),
|
||||
port: DEV_SERVER_PORT,
|
||||
open: true, // Automatically open browser on start
|
||||
proxy: {
|
||||
// Reverse proxy for CORS in development
|
||||
[env.VITE_APP_BASE_API]: {
|
||||
[API_BASE]: {
|
||||
target: "http://127.0.0.1:8081",
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user