优化结构

This commit is contained in:
Yvan
2026-08-28 16:23:52 +08:00
parent 9b1daaf3f6
commit 295ee5c49e
24 changed files with 128 additions and 145 deletions
+16 -9
View File
@@ -339,24 +339,34 @@ func maskDataSecrets(value *config.Data) {
return
}
if value.Database != nil {
value.Database.Password = config.MaskedSecret
if value.Database.Password != "" {
value.Database.Password = config.MaskedSecret
}
value.Database.Source = ""
}
if value.Redis != nil {
value.Redis.Password = config.MaskedSecret
if value.Redis.Password != "" {
value.Redis.Password = config.MaskedSecret
}
}
if value.Mongo != nil {
value.Mongo.Password = config.MaskedSecret
if value.Mongo.Password != "" {
value.Mongo.Password = config.MaskedSecret
}
}
for _, item := range value.DatabaseList {
if item != nil {
item.Password = config.MaskedSecret
if item.Password != "" {
item.Password = config.MaskedSecret
}
item.Source = ""
}
}
for _, item := range value.RedisList {
if item != nil {
item.Password = config.MaskedSecret
if item.Password != "" {
item.Password = config.MaskedSecret
}
}
}
}
@@ -407,14 +417,11 @@ func preserveDatabaseListSecrets(next, current []*config.Database) {
byName[item.AliasName] = item
}
}
for index, item := range next {
for _, item := range next {
if item == nil {
continue
}
previous := byName[item.AliasName]
if previous == nil && index < len(current) {
previous = current[index]
}
if previous == nil {
continue
}