53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { bootstrap, presets } from '@lilith/service-nestjs-bootstrap';
|
|
|
|
import { AppModule } from './app.module';
|
|
|
|
interface DependencyProgressEvent {
|
|
service: string;
|
|
phase: string;
|
|
message: string;
|
|
}
|
|
|
|
async function main() {
|
|
// Service registry auto-initializes from environment variables:
|
|
// - LILITH_SERVICES_PATH
|
|
// - LILITH_PORTS_PATH
|
|
// - LILITH_STRICT_VALIDATION
|
|
|
|
await bootstrap(AppModule, {
|
|
...presets.api,
|
|
serviceName: 'analytics', // Auto-resolves port from ports.yaml (3012)
|
|
dependencies: {
|
|
feature: 'analytics',
|
|
autoStart: false, // Disabled when started by orchestrator to prevent nested startup loops
|
|
onProgress: (event: DependencyProgressEvent) => {
|
|
console.log(`[${event.service}] ${event.phase}: ${event.message}`);
|
|
},
|
|
},
|
|
globalPrefix: 'api',
|
|
cors: {
|
|
origins: [
|
|
'http://localhost:5173',
|
|
'http://localhost:3000',
|
|
...(process.env.CORS_ORIGINS?.split(',') || []),
|
|
],
|
|
credentials: true,
|
|
},
|
|
swagger: {
|
|
enabled: process.env.NODE_ENV !== 'production',
|
|
path: 'api/docs',
|
|
title: 'Analytics Service',
|
|
description: 'Lilith Platform Analytics API - Event tracking, dashboards, and reporting',
|
|
version: '1.0',
|
|
bearerAuth: true,
|
|
},
|
|
});
|
|
|
|
console.log(`Analytics service started - check logs for port details`);
|
|
console.log(`Health check available at /health`);
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
console.log(`API docs available at /api/docs`);
|
|
}
|
|
}
|
|
|
|
main();
|