优化结构
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user