- Live waitlist integration with backend API - Real-time polling every 60 seconds - Comprehensive API logging and error handling - WaitlistContext for global state management - Responsive UI with live data updates - Registration form with automatic waitlist refresh - Modern React/TypeScript architecture - Tailwind CSS styling with luxury theme
72 lines
2.6 KiB
JavaScript
72 lines
2.6 KiB
JavaScript
/**
|
|
* API Configuration Test Script
|
|
*
|
|
* This script verifies that all API configurations are properly set up
|
|
* and that the URLs are correctly configured for different environments.
|
|
*/
|
|
|
|
// Load environment variables
|
|
require('dotenv').config();
|
|
|
|
const chalk = require('chalk');
|
|
|
|
function testConfiguration() {
|
|
console.log(chalk.bold('\n=== API Configuration Test ===\n'));
|
|
|
|
// Test environment variables
|
|
console.log(chalk.yellow('Environment Variables:'));
|
|
console.log(` VITE_API_BASE_URL: ${process.env.VITE_API_BASE_URL || 'undefined'}`);
|
|
console.log(` NODE_ENV: ${process.env.NODE_ENV || 'undefined'}`);
|
|
console.log(` DEBUG: ${process.env.DEBUG || 'undefined'}`);
|
|
console.log(` LOG_LEVEL: ${process.env.LOG_LEVEL || 'undefined'}\n`);
|
|
|
|
// Test URL logic from scripts
|
|
const scriptUrl = 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');
|
|
|
|
console.log(chalk.yellow('Script URL Resolution:'));
|
|
console.log(` Resolved URL: ${scriptUrl}\n`);
|
|
|
|
// Test individual components
|
|
console.log(chalk.yellow('Component URLs:'));
|
|
console.log(` API Status Checker: ${scriptUrl}`);
|
|
console.log(` React App (via VITE_API_BASE_URL): ${process.env.VITE_API_BASE_URL || 'Will use config.ts logic'}`);
|
|
console.log(` PennyzoApiService: Will use config.ts -> ${scriptUrl}\n`);
|
|
|
|
// Test endpoint construction
|
|
const testEndpoints = [
|
|
'/system/health',
|
|
'/registration/company/identity-rules',
|
|
'/auth/login',
|
|
'/auth/me',
|
|
'/users/profile'
|
|
];
|
|
|
|
console.log(chalk.yellow('Full Endpoint URLs:'));
|
|
testEndpoints.forEach(endpoint => {
|
|
console.log(` ${scriptUrl}${endpoint}`);
|
|
});
|
|
|
|
console.log(chalk.bold('\n=== Configuration Test Complete ===\n'));
|
|
|
|
// Summary
|
|
const isLocalhost = scriptUrl.includes('localhost');
|
|
const status = isLocalhost ?
|
|
chalk.green('✓ Configured for local development') :
|
|
chalk.blue('✓ Configured for production');
|
|
|
|
console.log(chalk.bold('Summary:'));
|
|
console.log(` ${status}`);
|
|
console.log(` Base URL: ${scriptUrl}`);
|
|
|
|
if (isLocalhost) {
|
|
console.log(chalk.yellow('\n Note: Ensure your backend server is running on localhost:8000'));
|
|
} else {
|
|
console.log(chalk.yellow('\n Note: Ensure the production API server is accessible'));
|
|
}
|
|
}
|
|
|
|
testConfiguration(); |