feat(updater): generate shared token without init container

This commit is contained in:
2026-10-05 19:11:05 +08:00
parent 9aaefa3b77
commit a7d71752e3
12 changed files with 351 additions and 11 deletions
+9 -1
View File
@@ -68,6 +68,14 @@ func New(cfg config.Config, staticFS fs.FS, migrationsDir string) (*App, error)
}
logger.Info("会话密钥已就绪", "module", "SYSTEM", "source", secretSource)
updaterToken, updaterTokenSource, err := updater.EnsureToken(cfg.UpdaterToken, cfg.UpdaterTokenFile)
if err != nil {
return nil, err
}
if updaterToken != "" {
logger.Info("updater Token 已就绪", "module", "SYSTEM", "source", updaterTokenSource)
}
conn, err := db.Open(cfg.DBPath())
if err != nil {
return nil, err
@@ -122,7 +130,7 @@ func New(cfg config.Config, staticFS fs.FS, migrationsDir string) (*App, error)
proxySvc.SetExitSync(cloudflareSvc)
startedAt := time.Now().UTC().Format(time.RFC3339)
trafficCollector := traffic.NewCollector(conn, filepath.Join(cfg.LogsDir(), "access.log"), notifySvc)
updaterClient := updater.NewClient(cfg.UpdaterSocket)
updaterClient := updater.NewClient(cfg.UpdaterSocket, updaterToken)
handler := api.NewRouter(api.Deps{
Config: cfg,