package models import "time" type StorageConfig struct { ID uint `json:"id"` Name string `json:"name"` StorageType string `json:"storageType"` Endpoint string `json:"endpoint"` Bucket string `json:"bucket"` Region string `json:"region"` AccessKey string `json:"accessKey"` SecretKey string `json:"secretKey"` PathPrefix string `json:"pathPrefix"` Insecure bool `json:"insecure"` IsDefault bool `json:"isDefault"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } func (s *StorageConfig) Sanitized() map[string]interface{} { return map[string]interface{}{ "id": s.ID, "name": s.Name, "storageType": s.StorageType, "endpoint": s.Endpoint, "bucket": s.Bucket, "region": s.Region, // accessKey / secretKey 明文返回:本平台为内网运维工具,管理员需要在 // 编辑弹框里看到并「测试连接」,脱敏会导致编辑时字段为空无法保存/测试。 "accessKey": s.AccessKey, "secretKey": s.SecretKey, "pathPrefix": s.PathPrefix, "insecure": s.Insecure, "isDefault": s.IsDefault, "hasSecretKey": s.SecretKey != "", "createdAt": s.CreatedAt, "updatedAt": s.UpdatedAt, } }