All checks were successful
Publish FaceAI Container / publish (push) Successful in 3m7s
- Introduced processor heartbeat configuration in environment variables and Docker setup. - Implemented heartbeat publishing in the processor worker. - Enhanced health check endpoint to include processor availability status. - Updated frontend components to handle processor unavailability messages. - Added legacy return functionality in the upload panel.
34 lines
2.2 KiB
JavaScript
34 lines
2.2 KiB
JavaScript
import path from 'node:path';
|
|
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: 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'
|
|
: process.env.NODE_ENV !== 'production',
|
|
localLegacyStaticRoot: process.env.FACEAI_LOCAL_LEGACY_STATIC_ROOT || defaultLocalLegacyRoot,
|
|
sharedSecret: process.env.FACEAI_SHARED_SECRET || 'change-me',
|
|
sessionCookieName: process.env.FACEAI_SESSION_COOKIE || 'rus_faceai_session',
|
|
redisUrl: process.env.FACEAI_REDIS_URL || 'redis://redis:6379',
|
|
queueName: process.env.FACEAI_QUEUE_NAME || 'faceai-searches',
|
|
runtimeRoot: process.env.FACEAI_RUNTIME_ROOT || '/data/runtime',
|
|
uploadRoot: process.env.FACEAI_UPLOAD_ROOT || path.join(process.env.FACEAI_RUNTIME_ROOT || '/data/runtime', 'uploads'),
|
|
searchTtlSeconds: Number(process.env.FACEAI_SEARCH_TTL_SECONDS || 24 * 60 * 60),
|
|
resultTtlSeconds: Number(process.env.FACEAI_RESULT_TTL_SECONDS || 24 * 60 * 60),
|
|
processorHeartbeatGraceMs: Number(process.env.FACEAI_PROCESSOR_HEARTBEAT_GRACE_MS || 20 * 1000),
|
|
rateLimitWindowSeconds: Number(process.env.FACEAI_RATE_LIMIT_WINDOW_SECONDS || 10 * 60),
|
|
rateLimitMaxRequests: Number(process.env.FACEAI_RATE_LIMIT_MAX_REQUESTS || 5)
|
|
};
|