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:
@@ -38,6 +38,40 @@ These scripts test both public and authenticated endpoints of the Pennyzo Genera
|
||||
|
||||
Both required packages are already installed in the project.
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
The API endpoints are now environment-aware. By default:
|
||||
|
||||
- **Development**: `http://localhost:8000`
|
||||
- **Production**: `https://api.pennyzo.com/api/v1/general`
|
||||
|
||||
### Setting Environment
|
||||
|
||||
Use the following npm scripts to configure your environment:
|
||||
|
||||
```bash
|
||||
# Set development environment (localhost:8000)
|
||||
npm run env:dev
|
||||
|
||||
# Set production environment (api.pennyzo.com)
|
||||
npm run env:prod
|
||||
|
||||
# Show current environment configuration
|
||||
npm run env:show
|
||||
```
|
||||
|
||||
Alternatively, manually create a `.env` file:
|
||||
|
||||
```bash
|
||||
# For development
|
||||
VITE_API_BASE_URL=http://localhost:8000
|
||||
NODE_ENV=development
|
||||
|
||||
# For production
|
||||
VITE_API_BASE_URL=https://api.pennyzo.com/api/v1/general
|
||||
NODE_ENV=production
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Using npm Scripts (Recommended)
|
||||
|
||||
Reference in New Issue
Block a user