feat: Phase 1 MVP — complete AgentIdP implementation
Implements all P0 features per OpenSpec change phase-1-mvp-implementation: - Agent Registry Service (CRUD) — full lifecycle management - OAuth 2.0 Token Service (Client Credentials flow) - Credential Management (generate, rotate, revoke) - Immutable Audit Log Service Tech: Node.js 18+, TypeScript 5.3+ strict, Express 4.18+, PostgreSQL 14+, Redis 7+ Standards: OpenAPI 3.0 specs, DRY/SOLID, zero `any` types Quality: 18 unit test suites, 244 tests passing, 97%+ coverage OpenAPI: 4 complete specs (14 endpoints total) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
47
src/server.ts
Normal file
47
src/server.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Server entry point for SentryAgent.ai AgentIdP.
|
||||
* Loads environment variables, creates the app, and starts listening.
|
||||
*/
|
||||
|
||||
import * as dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
import { createApp } from './app.js';
|
||||
|
||||
const PORT = parseInt(process.env['PORT'] ?? '3000', 10);
|
||||
|
||||
/**
|
||||
* Bootstraps the application and starts the HTTP server.
|
||||
*/
|
||||
async function main(): Promise<void> {
|
||||
try {
|
||||
const app = await createApp();
|
||||
|
||||
const server = app.listen(PORT, () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`SentryAgent.ai AgentIdP listening on port ${PORT}`);
|
||||
});
|
||||
|
||||
// Graceful shutdown
|
||||
const shutdown = (): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting down gracefully...');
|
||||
server.close(() => {
|
||||
process.exit(0);
|
||||
});
|
||||
};
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
shutdown();
|
||||
});
|
||||
process.on('SIGINT', () => {
|
||||
shutdown();
|
||||
});
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Failed to start server:', err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void main();
|
||||
Reference in New Issue
Block a user