refactor: simplify architecture and harden lifecycle

Remove obsolete implementations, centralize background task ownership and terminal-state recovery, consolidate frontend routing and log streaming, and enforce project-wide verification in CI.
This commit is contained in:
Awuqing
2026-08-26 11:32:00 +08:00
parent 95b27af600
commit c06bbec383
189 changed files with 8983 additions and 4264 deletions
+14
View File
@@ -9,6 +9,8 @@ import (
"syscall"
"backupx/server/internal/agent"
"backupx/server/internal/config"
applogger "backupx/server/internal/logger"
)
// runAgent 是 `backupx agent` 子命令入口。
@@ -59,11 +61,23 @@ func runAgent(args []string) {
os.Exit(2)
}
agentLogger, err := applogger.New(config.LogConfig{Level: "info"})
if err != nil {
fmt.Fprintf(os.Stderr, "agent: init logger: %v\n", err)
os.Exit(1)
}
defer func() {
if syncErr := agentLogger.Sync(); syncErr != nil {
fmt.Fprintf(os.Stderr, "agent: flush logger: %v\n", syncErr)
}
}()
a, err := agent.New(cfg, version)
if err != nil {
fmt.Fprintf(os.Stderr, "agent: init: %v\n", err)
os.Exit(1)
}
a.SetLogger(agentLogger)
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()