优化结构
This commit is contained in:
+13
@@ -9,12 +9,16 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"kra/internal/app"
|
||||
"kra/internal/conf"
|
||||
"kra/internal/server/router"
|
||||
"kra/internal/service"
|
||||
"kra/internal/service/dto"
|
||||
"kra/internal/worker"
|
||||
"kra/pkg/logging"
|
||||
"kra/pkg/module"
|
||||
"kra/pkg/mq"
|
||||
platformtask "kra/pkg/task"
|
||||
|
||||
"github.com/go-kratos/kratos/v3"
|
||||
"github.com/go-kratos/kratos/v3/config"
|
||||
@@ -41,6 +45,15 @@ 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.RuntimeContributions {
|
||||
return app.RuntimeContributions{
|
||||
Routes: []module.RouteRegistrar{systemRoutes},
|
||||
Tasks: []platformtask.Contributor{systemTasks},
|
||||
}
|
||||
}
|
||||
|
||||
func newApp(logger *slog.Logger, hs *kratoshttp.Server, scheduler *worker.TaskScheduler, audit *service.AuditRecorder, loggerControl *logging.ReloadableLogger, _ mq.Client) *kratos.App {
|
||||
if audit != nil && loggerControl != nil {
|
||||
loggerControl.SetErrorSink(logging.ErrorSinkFunc(func(ctx context.Context, entry logging.ErrorEntry) error {
|
||||
|
||||
Generated
+2
-1
@@ -139,7 +139,8 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger
|
||||
tokenService := service.NewTokenService(tokenUsecase, tokenIssuer)
|
||||
apiToken := handler.NewAPIToken(tokenService)
|
||||
initializationRepo := initialize.NewRepo(dataData, catalog)
|
||||
systemConfigUsecase := system2.NewSystemConfigUsecase(initializationRepo, taskRuntime)
|
||||
taskReloader := worker.NewTaskReloader(taskScheduler)
|
||||
systemConfigUsecase := system2.NewSystemConfigUsecase(initializationRepo, taskReloader)
|
||||
systemConfigService := service.NewSystemConfigService(systemConfigUsecase, runtimeSettings)
|
||||
systemConfig := handler.NewSystemConfig(systemConfigService, securityService)
|
||||
public := handler.NewPublic(authService, systemConfigService, securityService)
|
||||
|
||||
Reference in New Issue
Block a user