优化结构

This commit is contained in:
Yvan
2026-08-24 13:56:06 +08:00
parent 0b6b8ddf1a
commit acaee94858
21 changed files with 249 additions and 3025 deletions
+6 -2
View File
@@ -6,6 +6,7 @@ import (
"time"
"github.com/fsnotify/fsnotify"
"kra/internal/config"
)
// watchConfig refreshes the in-memory config snapshot on file changes, while
@@ -79,10 +80,13 @@ func (d *Data) watchConfig() func() {
logger.Error("reload changed config", "mod", "system", "error", loadErr)
continue
}
if next.Data == nil || next.Admin == nil {
logger.Error("reload changed config: data and admin configuration are required", "mod", "system")
if next.Data == nil {
logger.Error("reload changed config: data configuration is required", "mod", "system")
continue
}
if next.Admin == nil {
next.Admin = &config.Admin{}
}
if current := d.runtime.Admin(); current != nil {
next.Admin.Storage = current.Storage
next.Admin.Email = current.Email