forked from baron/baron-sso
feat: integrate orgfront and expose internal ids
This commit is contained in:
58
orgfront/vite.config.ts
Normal file
58
orgfront/vite.config.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
const defaultAllowedHosts = [
|
||||
"baron-orgchart.hmac.kr",
|
||||
"sdev.hmac.kr",
|
||||
"localhost",
|
||||
"172.16.10.176",
|
||||
"127.0.0.1",
|
||||
];
|
||||
|
||||
function hostFromUrl(value: string | undefined) {
|
||||
if (!value) return undefined;
|
||||
try {
|
||||
return new URL(value).hostname;
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const allowedHosts = Array.from(
|
||||
new Set(
|
||||
[
|
||||
...defaultAllowedHosts,
|
||||
hostFromUrl(process.env.ORGFRONT_URL),
|
||||
...(process.env.ORGFRONT_ALLOWED_HOSTS ?? "")
|
||||
.split(",")
|
||||
.map((host) => host.trim())
|
||||
.filter(Boolean),
|
||||
].filter((host): host is string => Boolean(host)),
|
||||
),
|
||||
);
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 5175,
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://localhost:5000",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
preview: {
|
||||
host: "0.0.0.0",
|
||||
port: 5175,
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://localhost:5000",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user