+5
-1
@@ -119,17 +119,21 @@ func run() error {
|
||||
notifier := service.NewNotifier(settings)
|
||||
auth.SetNotifier(notifier, settings)
|
||||
oauth := service.NewOAuthService(db, settings, auth)
|
||||
passkeys := service.NewPasskeyService(db, settings, auth)
|
||||
wallets := service.NewWalletService(db, settings, auth)
|
||||
systemLogs := service.NewSystemLogService(db)
|
||||
logEvents := service.NewLogEventService(db)
|
||||
logEvents.SetRelayDeps(ociConfigs, ociClient, cfg.PublicURL)
|
||||
logEvents.SetNotifier(notifier, settings)
|
||||
cleanupCtx, stopCleanup := context.WithCancel(context.Background())
|
||||
systemLogs.StartCleanup(cleanupCtx)
|
||||
auth.StartSessionCleanup(cleanupCtx)
|
||||
logEvents.StartParser(cleanupCtx)
|
||||
logEvents.StartCleanup(cleanupCtx)
|
||||
aiGateway := service.NewAiGatewayService(db, ociConfigs, ociClient)
|
||||
aiGateway.StartCleanup(cleanupCtx)
|
||||
// defer 为 LIFO:先停调度与清理,再等在途通知与日志写完
|
||||
defer auth.WaitSessionCleanup()
|
||||
defer logEvents.Wait()
|
||||
defer systemLogs.Wait()
|
||||
defer notifier.Wait()
|
||||
@@ -150,7 +154,7 @@ func run() error {
|
||||
defer proxies.Wait()
|
||||
// 「关于」页存储指标需知数据库形态
|
||||
api.SetAboutRuntime(cfg.DBDriver, cfg.DBPath)
|
||||
router := api.NewRouter(auth, oauth, ociConfigs, tasks, console, settings, notifier, systemLogs, logEvents, proxies, aiGateway)
|
||||
router := api.NewRouter(auth, oauth, passkeys, wallets, ociConfigs, tasks, console, settings, notifier, systemLogs, logEvents, proxies, aiGateway)
|
||||
return serveHTTP(cfg.Addr, router)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user