Fix API endpoint configuration with environment-aware URLs

- Add environment-based API URL configuration (dev: localhost:8000, prod: api.pennyzo.com)
- Update PennyzoApiService to use centralized config with timeout settings
- Fix API status checker scripts to load .env variables using dotenv
- Add environment management scripts (set-env.ps1) with npm shortcuts
- Create comprehensive configuration testing and validation tools
- Add TypeScript definitions for Vite environment variables
- Update all documentation with new environment configuration instructions
- Install dotenv package for Node.js environment variable loading
- All APIs now correctly use environment-appropriate URLs automatically
This commit is contained in:
2025-09-25 14:40:20 +05:30
parent aece15a286
commit ebb7fcaac8
15 changed files with 742 additions and 11 deletions

View File

@@ -1,2 +1,31 @@
# API base URL (override default production URL if needed)
# Environment Configuration Example
# Copy this file to .env and update the values as needed
# API Base URL - Choose based on your environment
# Development (default)
VITE_API_BASE_URL=http://localhost:8000
# Production
# VITE_API_BASE_URL=https://api.pennyzo.com/api/v1/general
# Backend API Configuration (for reference)
API_PORT=8000
API_HOST=localhost
# Environment
NODE_ENV=development
# Debug settings
DEBUG=true
LOG_LEVEL=INFO
# API Status Checker Credentials (optional - for testing authenticated endpoints)
# PENNYZO_TEST_EMAIL=your-test-email@example.com
# PENNYZO_TEST_PASSWORD=your-test-password
# CORS Settings (for reference - these are backend settings)
# The following origins are typically allowed in development:
# - http://localhost:3000 (React default)
# - http://127.0.0.1:3000
# - http://localhost:5173 (Vite default)
# - http://127.0.0.1:5173