Use STORYKIT_PORT for both backend and frontend, add .story_kit_port to ignore files

Single env var STORYKIT_PORT configures backend port, frontend proxy target,
frontend dev server port (port + 2172), and WebSocket host. Added .story_kit_port
to .gitignore and .ignore to prevent git tracking and cargo watch restart loops.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-19 17:29:50 +00:00
parent f7902c3569
commit 7e56648954
4 changed files with 11 additions and 4 deletions

View File

@@ -3,14 +3,17 @@ import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig(() => {
const backendPort = process.env.VITE_STORYKIT_PORT || "3001";
const backendPort = Number(process.env.STORYKIT_PORT || "3001");
return {
plugins: [react()],
define: {
__STORYKIT_PORT__: JSON.stringify(String(backendPort)),
},
server: {
port: 5173,
port: backendPort + 2172,
proxy: {
"/api": {
target: `http://127.0.0.1:${backendPort}`,
target: `http://127.0.0.1:${String(backendPort)}`,
timeout: 120000,
},
},