Add legacy URL handling and update environment configurations

This commit is contained in:
MaddoScientisto 2026-04-19 08:48:15 +02:00
commit 9f56dfba1d
11 changed files with 79 additions and 28 deletions

View file

@ -3,13 +3,18 @@ import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const defaultLocalLegacyRoot = path.resolve(__dirname, '../../../../www');
const isProduction = process.env.NODE_ENV === 'production';
function envOrDefault(name, defaultValue) {
return process.env[name] || defaultValue;
}
export const config = {
port: Number(process.env.PORT || 3001),
frontendUrl: process.env.FACEAI_FRONTEND_URL || 'http://localhost:5173',
publicBaseUrl: process.env.FACEAI_PUBLIC_BASE_URL || 'http://localhost:3001',
legacyReturnUrl: process.env.FACEAI_LEGACY_RETURN_URL || 'http://localhost:3001/dev/legacy/return',
legacyHomeUrl: process.env.FACEAI_LEGACY_HOME_URL || 'http://localhost:8080/index.jsp',
frontendUrl: envOrDefault('FACEAI_FRONTEND_URL', isProduction ? 'https://ai.regalamiunsorriso.it' : 'http://localhost:5173'),
publicBaseUrl: envOrDefault('FACEAI_PUBLIC_BASE_URL', isProduction ? 'https://ai.regalamiunsorriso.it' : 'http://localhost:3001'),
legacyReturnUrl: envOrDefault('FACEAI_LEGACY_RETURN_URL', isProduction ? 'https://www.regalamiunsorriso.it/faceai_return.php' : 'http://localhost:3001/dev/legacy/return'),
legacyHomeUrl: envOrDefault('FACEAI_LEGACY_HOME_URL', isProduction ? 'https://www.regalamiunsorriso.it/' : 'http://localhost:8080/index.jsp'),
pklRoot: process.env.FACEAI_PKL_ROOT || '/data/pkl',
enableLocalLegacyStatic: process.env.FACEAI_ENABLE_LOCAL_LEGACY_STATIC
? process.env.FACEAI_ENABLE_LOCAL_LEGACY_STATIC === '1'