multica/apps/desktop/.env.example
yushen 4dba1cfdf0 refactor: unify API URL env var to MULTICA_API_URL
Replace scattered API_URL, MAIN_VITE_API_URL, and RENDERER_VITE_API_URL
with a single MULTICA_API_URL across all apps and packages.

- Desktop: use envPrefix to expose MULTICA_* to main process, rename
  RENDERER_VITE_API_URL → RENDERER_VITE_MULTICA_API_URL, remove
  MAIN_VITE_API_URL (now read directly via MULTICA_API_URL)
- Web: add .env.development with MULTICA_API_URL, enforce required check
  in next.config.ts, update .gitignore to allow .env.development
- Core: make MULTICA_API_URL required in api-client (no silent fallback)
- Scripts: pass MULTICA_API_URL in dev-local.sh for web process
- Turbo: update globalEnv from API_URL to MULTICA_API_URL
- Docs: update references to the new env var name

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:31:00 +08:00

99 lines
4.2 KiB
Text

# =============================================================================
# Multica Desktop Environment Configuration
# =============================================================================
#
# This file documents all available environment variables for Desktop builds.
# Copy this file and rename it based on your target environment.
#
# =============================================================================
# Build Commands
# =============================================================================
#
# Development (no .env file needed):
# pnpm dev # Uses hardcoded dev defaults
#
# Staging Build:
# pnpm build:staging # Uses .env.staging
#
# Production Build:
# pnpm build:production # Uses .env.production
#
# Default Build (uses .env.production):
# pnpm build:desktop # Same as build:production
#
# =============================================================================
# Build Output
# =============================================================================
#
# After build completes, installer packages are located at:
#
# apps/desktop/release/{version}/
# ├── Multica-{version}-arm64.dmg # macOS Apple Silicon
# ├── Multica-{version}-x64.dmg # macOS Intel
# ├── Multica-Windows-{version}-Setup.exe # Windows
# ├── Multica-Linux-{version}.AppImage # Linux AppImage
# └── Multica-Linux-{version}.deb # Linux deb
#
# Compiled code (before packaging) is in:
# apps/desktop/out/
#
# =============================================================================
# Configuration Guide
# =============================================================================
#
# For production builds, create .env.production with the following variables:
#
# Required:
# MAIN_VITE_GATEWAY_URL - WebSocket Gateway URL for remote connections
# MAIN_VITE_WEB_URL - Web App URL for OAuth login flow
# RENDERER_VITE_MULTICA_API_URL - API URL for renderer process (UI requests)
# MULTICA_API_URL - API URL for core/tools and main process bridge
#
# Example .env.production:
# MAIN_VITE_GATEWAY_URL=https://gateway.multica.ai
# MAIN_VITE_WEB_URL=https://www.multica.ai
# RENDERER_VITE_MULTICA_API_URL=https://api.multica.ai
# MULTICA_API_URL=https://api.multica.ai
#
# =============================================================================
# Variable Naming Convention
# =============================================================================
#
# 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)
# Also available in main process via envPrefix config
#
# =============================================================================
# Environment Variables
# =============================================================================
# MAIN_VITE_GATEWAY_URL
# WebSocket Gateway URL - Hub connects here for remote device access (QR code pairing)
# Production example: https://gateway.multica.ai
MAIN_VITE_GATEWAY_URL=http://localhost:3000
# MAIN_VITE_WEB_URL
# 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
# RENDERER_VITE_MULTICA_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_MULTICA_API_URL=http://localhost:8080
# MULTICA_API_URL
# API URL for core/tools and main process bridge - Used by agent engine tools
# (web-search, finance) and bridged to process.env in packaged builds.
# Read by core package via process.env.MULTICA_API_URL at runtime.
# Production example: https://api.multica.ai
MULTICA_API_URL=http://localhost:8080
# SMC_DATA_DIR
# Root data directory override - Isolates dev data from production.
# When set, all data (sessions, credentials, profiles, app-state, etc.)
# is stored under this directory instead of ~/.super-multica.
# Supports ~ expansion. Set automatically by scripts/dev-local.sh.
# SMC_DATA_DIR=~/.super-multica-dev