优化结构
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"kra/internal/conf"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func cloneAdminConfig(value *conf.AdminBackend) *conf.AdminBackend {
|
||||
if value == nil {
|
||||
return &conf.AdminBackend{}
|
||||
}
|
||||
return proto.Clone(value).(*conf.AdminBackend)
|
||||
}
|
||||
|
||||
func maskStorageSecrets(storage *conf.AdminBackend_Storage) {
|
||||
if storage == nil {
|
||||
return
|
||||
}
|
||||
if storage.Qiniu != nil && storage.Qiniu.SecretKey != "" {
|
||||
storage.Qiniu.SecretKey = "******"
|
||||
}
|
||||
for _, item := range []*conf.AdminBackend_ObjectStore{
|
||||
storage.AliyunOss,
|
||||
storage.HuaweiObs,
|
||||
storage.TencentCos,
|
||||
storage.AwsS3,
|
||||
storage.CloudflareR2,
|
||||
storage.Minio,
|
||||
} {
|
||||
if item != nil && item.SecretKey != "" {
|
||||
item.SecretKey = "******"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user