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:
@@ -12,6 +12,9 @@
|
||||
* - Supports command line arguments for customization
|
||||
*/
|
||||
|
||||
// Load environment variables from .env file
|
||||
require('dotenv').config();
|
||||
|
||||
const axios = require('axios');
|
||||
const chalk = require('chalk');
|
||||
const fs = require('fs');
|
||||
@@ -23,8 +26,12 @@ const saveReport = !args.includes('--no-report');
|
||||
const verbose = args.includes('--verbose');
|
||||
const useRealCredentials = args.includes('--use-real-credentials');
|
||||
|
||||
// Define the base URL
|
||||
const BASE_URL = 'https://api.pennyzo.com/api/v1/general';
|
||||
// Define the base URL based on environment
|
||||
const BASE_URL = process.env.VITE_API_BASE_URL ||
|
||||
process.env.API_BASE_URL ||
|
||||
(process.env.NODE_ENV === 'production' ?
|
||||
'https://api.pennyzo.com/api/v1/general' :
|
||||
'http://localhost:8000');
|
||||
|
||||
// Test credentials
|
||||
const TEST_CREDENTIALS = {
|
||||
|
||||
Reference in New Issue
Block a user