chore(desktop): add env files for dev/production and update dev scripts

- Track .env.development and .env.production for desktop app
- Add MAIN_VITE_API_URL to all env files
- Remove hardcoded GATEWAY_URL from dev scripts (now in .env.development)
- Update .env.example with full documentation of all env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yushen 2026-02-14 07:30:54 +08:00
parent ef32078b3c
commit eb07f12c49
5 changed files with 50 additions and 2 deletions

View file

@ -46,10 +46,16 @@
# Required:
# MAIN_VITE_GATEWAY_URL - WebSocket Gateway URL for remote connections
# MAIN_VITE_WEB_URL - Web App URL for OAuth login flow
# MAIN_VITE_API_URL - API URL bridged to process.env for core package
# RENDERER_VITE_API_URL - API URL for renderer process (UI requests)
# MULTICA_API_URL - API URL for core/tools (web-search, finance)
#
# Example .env.production:
# MAIN_VITE_GATEWAY_URL=https://gateway.multica.ai
# MAIN_VITE_WEB_URL=https://www.multica.ai
# MAIN_VITE_API_URL=https://api.multica.ai
# RENDERER_VITE_API_URL=https://api.multica.ai
# MULTICA_API_URL=https://api.multica.ai
#
# =============================================================================
# Variable Naming Convention
@ -58,6 +64,7 @@
# MAIN_VITE_* - Main process only (Node.js, full system access)
# RENDERER_VITE_* - Renderer process only (browser context)
# VITE_* - All processes
# MULTICA_* - Core/CLI/Gateway (read via process.env at runtime)
#
# =============================================================================
# Environment Variables
@ -72,3 +79,21 @@ MAIN_VITE_GATEWAY_URL=http://localhost:3000
# Web App URL - Desktop opens this URL for user login (OAuth flow)
# Production example: https://www.multica.ai
MAIN_VITE_WEB_URL=http://localhost:3000
# MAIN_VITE_API_URL
# API URL for main process - Bridged to process.env.MULTICA_API_URL at startup
# so that the externalized @multica/core package can read the correct API URL
# in packaged builds (where .env files are not bundled).
# Production example: https://api.multica.ai
MAIN_VITE_API_URL=http://localhost:8080
# RENDERER_VITE_API_URL
# API URL for renderer process - Used by the React UI for login, user info, etc.
# Production example: https://api.multica.ai
RENDERER_VITE_API_URL=http://localhost:8080
# MULTICA_API_URL
# API URL for core/tools - Used by agent engine tools (web-search, finance)
# Read by core package via process.env.MULTICA_API_URL at runtime
# Production example: https://api.multica.ai
MULTICA_API_URL=http://localhost:8080