()
| 640 | // process.env and inject them as `window.__HF_STUDIO_ENV__` so the client |
| 641 | // can pick them up at runtime, overriding the baked defaults. |
| 642 | function buildRuntimeEnvScript(): string { |
| 643 | const overrides: Record<string, string> = {}; |
| 644 | for (const [key, value] of Object.entries(process.env)) { |
| 645 | if (key.startsWith("VITE_STUDIO_") && value !== undefined) { |
| 646 | overrides[key] = value; |
| 647 | } |
| 648 | } |
| 649 | if (Object.keys(overrides).length === 0) return ""; |
| 650 | return `<script>window.__HF_STUDIO_ENV__=${JSON.stringify(overrides)};</script>`; |
| 651 | } |
| 652 | |
| 653 | // SPA fallback |
| 654 | app.get("*", (c) => { |
no test coverage detected