refactor: extract inline middleware from index.ts into separate modules (#85)
- Extract update middleware to routes/update.ts - Extract health middleware and version logic to routes/health.ts - Extract shutdown logic to services/shutdown.ts - Extract gateway init to services/gateway-bootstrap.ts - Remove unused variables, fix duplicate app creation - Bump version to 0.4.0 index.ts: 260 lines → 80 lines Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
let gatewayManager: any = null
|
||||
|
||||
export function getGatewayManagerInstance(): any {
|
||||
return gatewayManager
|
||||
}
|
||||
|
||||
export async function initGatewayManager(): Promise<void> {
|
||||
const { GatewayManager } = await import('./hermes/gateway-manager')
|
||||
const { getActiveProfileName } = await import('./hermes/hermes-profile')
|
||||
const { setGatewayManager } = await import('../routes/hermes/gateways')
|
||||
|
||||
const activeProfile = getActiveProfileName()
|
||||
gatewayManager = new GatewayManager(activeProfile)
|
||||
setGatewayManager(gatewayManager)
|
||||
|
||||
await gatewayManager.detectAllOnStartup()
|
||||
await gatewayManager.startAll()
|
||||
}
|
||||
Reference in New Issue
Block a user