Per Corentin's feedback (2026-05-08): .env should be reserved for server-side config (SMTP, DB, OIDC). Branding (name, colors, logo) is admin/UI territory. Changes: - Remove BRAND_NAME / BRAND_LOGO_URL / BRAND_PRIMARY_COLOR / BRAND_ACCENT_COLOR from .env.example, vite.config.ts define block - Hardcode "AcadeDoc" + #2563eb / #7c3aed as defaults in apps/client/src/lib/config.ts and brand-theme.ts - getBrandTheme() now takes optional runtime overrides instead of reading process.env (used by per-workspace branding hook to apply DB-stored colors) - Server getMailFromName() defaults to "AcadeDoc" hardcoded; only MAIL_FROM_NAME env var can override - Fix workspace-branding.spec.ts (was importing vitest in jest project, R4.4 leftover bug, similar to Patch 017 scope) - Fix environment.service.spec.ts (was missing ConfigService provider in TestingModule, pre-existing upstream bug surfaced by jest run) Tests: 13 brand-theme + 13 workspace-branding + 2 environment = 28 green. Per-workspace UI override via /settings/branding (R4.4) works unchanged. Patch 020.
76 lines
1.7 KiB
TypeScript
76 lines
1.7 KiB
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import * as path from "path";
|
|
|
|
const envPath = path.resolve(process.cwd(), "..", "..");
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const {
|
|
APP_URL,
|
|
FILE_UPLOAD_SIZE_LIMIT,
|
|
FILE_IMPORT_SIZE_LIMIT,
|
|
DRAWIO_URL,
|
|
CLOUD,
|
|
SUBDOMAIN_HOST,
|
|
COLLAB_URL,
|
|
BILLING_TRIAL_DAYS,
|
|
POSTHOG_HOST,
|
|
POSTHOG_KEY,
|
|
} = loadEnv(mode, envPath, "");
|
|
|
|
return {
|
|
define: {
|
|
"process.env": {
|
|
APP_URL,
|
|
FILE_UPLOAD_SIZE_LIMIT,
|
|
FILE_IMPORT_SIZE_LIMIT,
|
|
DRAWIO_URL,
|
|
CLOUD,
|
|
SUBDOMAIN_HOST,
|
|
COLLAB_URL,
|
|
BILLING_TRIAL_DAYS,
|
|
POSTHOG_HOST,
|
|
POSTHOG_KEY,
|
|
},
|
|
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
|
},
|
|
plugins: [react()],
|
|
build: {
|
|
rolldownOptions: {
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{ name: "vendor-mantine", test: /@mantine/ },
|
|
{ name: "vendor-mermaid", test: /mermaid|cytoscape|elkjs/ },
|
|
{ name: "vendor-excalidraw", test: /excalidraw/ },
|
|
{ name: "vendor-katex", test: /katex/ },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": "/src",
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: APP_URL,
|
|
changeOrigin: false,
|
|
},
|
|
"/socket.io": {
|
|
target: APP_URL,
|
|
ws: true,
|
|
rewriteWsOrigin: true,
|
|
},
|
|
"/collab": {
|
|
target: APP_URL,
|
|
ws: true,
|
|
rewriteWsOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|