优化结构
This commit is contained in:
+11
-8
@@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"kra/internal/app"
|
||||
"kra/internal/config"
|
||||
"kra/internal/server/router"
|
||||
"kra/internal/service"
|
||||
@@ -50,13 +49,17 @@ func init() {
|
||||
flag.StringVar(&flagconf, "conf", "./configs", "config path, eg: -conf config.yaml")
|
||||
}
|
||||
|
||||
// runtimeContributions is the binary-level list of modules with constructed
|
||||
// route or task dependencies. Adding another runtime module is explicit here.
|
||||
func runtimeContributions(systemRoutes *router.Routes, systemTasks *worker.TaskMethods) app.Composition {
|
||||
return app.Composition{
|
||||
Routes: []module.RouteRegistrar{systemRoutes},
|
||||
Tasks: []platformtask.Contributor{systemTasks},
|
||||
}
|
||||
// taskRegistry builds the process-wide registry from the dependency-free task
|
||||
// methods the static module catalog declares. Methods whose handlers need
|
||||
// constructed usecases are added later by buildRuntime.
|
||||
func taskRegistry() *platformtask.Registry { return platformtask.NewRegistry() }
|
||||
|
||||
// buildRuntime is the binary-level list of modules with constructed route or
|
||||
// task dependencies: it activates their task methods and composes their routes.
|
||||
// Adding another runtime module is explicit here.
|
||||
func buildRuntime(registry *platformtask.Registry, systemRoutes *router.Routes, systemTasks *worker.TaskMethods) module.RouteRegistrar {
|
||||
systemTasks.RegisterTasks(registry)
|
||||
return systemRoutes
|
||||
}
|
||||
|
||||
func newApp(logger *slog.Logger, hs *kratoshttp.Server, scheduler *worker.TaskScheduler, audit *service.AuditRecorder, loggerControl *logging.ReloadableLogger, _ mq.Client) *kratos.App {
|
||||
|
||||
Reference in New Issue
Block a user