🗑️ Deprecate deploy-pokedex.js in favor of deploy.sh and update environment variable validation messages

This commit is contained in:
2026-01-30 11:29:28 -05:00
parent fee8fe2551
commit 84f1fcb42a
3 changed files with 51 additions and 36 deletions

View File

@@ -35,24 +35,30 @@ const REQUIRED_ENV_VARS = {
description: 'Frontend URL for CORS',
validate: (val, env) => {
if (!val) return false;
// Validate that FRONTEND_URL matches DEPLOYMENT_TARGET (if set)
const target = env?.DEPLOYMENT_TARGET;
if (!target) return true; // Skip validation if target not set yet
if (target === 'dev' && !val.includes('localhost:5173')) {
console.error('⚠️ FRONTEND_URL should be http://localhost:5173 for dev target');
console.error(
'⚠️ FRONTEND_URL should be http://localhost:5173 for dev target'
);
return false;
}
if (target === 'docker-local' && !val.includes('localhost:8099')) {
console.error('⚠️ FRONTEND_URL should be http://localhost:8099 for docker-local target');
console.error(
'⚠️ FRONTEND_URL should be http://localhost:8099 for docker-local target'
);
return false;
}
if (target === 'production' && !val.includes('app.pokedex.online')) {
console.error('⚠️ FRONTEND_URL should be https://app.pokedex.online for production target');
console.error(
'⚠️ FRONTEND_URL should be https://app.pokedex.online for production target'
);
return false;
}
return true;
}
},
@@ -137,7 +143,9 @@ export function validateOrExit(exitOnError = true) {
// Print validation results
console.log('\n🔍 Environment Validation:');
console.log(` DEPLOYMENT_TARGET: ${process.env.DEPLOYMENT_TARGET || 'not set'}`);
console.log(
` DEPLOYMENT_TARGET: ${process.env.DEPLOYMENT_TARGET || 'not set'}`
);
console.log(` NODE_ENV: ${process.env.NODE_ENV || 'not set'}`);
console.log(` PORT: ${process.env.PORT || 'not set'}`);
console.log(` FRONTEND_URL: ${process.env.FRONTEND_URL || 'not set'}`);
@@ -180,7 +188,7 @@ export function validateOrExit(exitOnError = true) {
export function getConfig() {
const deploymentTarget = process.env.DEPLOYMENT_TARGET || 'dev';
const frontendUrl = process.env.FRONTEND_URL;
return {
deploymentTarget,
nodeEnv: process.env.NODE_ENV || 'development',