diff --git a/internal/api/third/minio_init.go b/internal/api/third/minio_init.go index 8c1038e86..4580a6304 100644 --- a/internal/api/third/minio_init.go +++ b/internal/api/third/minio_init.go @@ -47,8 +47,10 @@ func MinioInit() { return } opt := minio.MakeBucketOptions{ - Region: config.Config.Credential.Minio.Location, - ObjectLocking: false, + Region: config.Config.Credential.Minio.Location, + } + if config.Config.Credential.Minio.IsDistributedMod == true { + opt.ObjectLocking = true } err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt) if err != nil { diff --git a/internal/api/third/minio_storage_credential.go b/internal/api/third/minio_storage_credential.go index 7f6c81638..4c6fad1f2 100644 --- a/internal/api/third/minio_storage_credential.go +++ b/internal/api/third/minio_storage_credential.go @@ -161,6 +161,7 @@ func MinioStorageCredential(c *gin.Context) { resp.BucketName = config.Config.Credential.Minio.Bucket resp.StsEndpointURL = config.Config.Credential.Minio.Endpoint resp.StorageTime = config.Config.Credential.Minio.StorageTime + resp.IsDistributedMod = config.Config.Credential.Minio.IsDistributedMod c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp}) } diff --git a/pkg/base_info/third_api_struct.go b/pkg/base_info/third_api_struct.go index 8785ecd37..ddf9291ec 100644 --- a/pkg/base_info/third_api_struct.go +++ b/pkg/base_info/third_api_struct.go @@ -7,12 +7,13 @@ type MinioStorageCredentialReq struct { } type MiniostorageCredentialResp struct { - SecretAccessKey string `json:"secretAccessKey"` - AccessKeyID string `json:"accessKeyID"` - SessionToken string `json:"sessionToken"` - BucketName string `json:"bucketName"` - StsEndpointURL string `json:"stsEndpointURL"` - StorageTime int `json:"storageTime"` + SecretAccessKey string `json:"secretAccessKey"` + AccessKeyID string `json:"accessKeyID"` + SessionToken string `json:"sessionToken"` + BucketName string `json:"bucketName"` + StsEndpointURL string `json:"stsEndpointURL"` + StorageTime int `json:"storageTime"` + IsDistributedMod bool `json:"isDistributedMod"` } type MinioUploadFileReq struct { diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 6c0e1a499..dc73cf25a 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -72,6 +72,7 @@ type config struct { EndpointInner string `yaml:"endpointInner"` EndpointInnerEnable bool `yaml:"endpointInnerEnable"` StorageTime int `yaml:"storageTime"` + IsDistributedMod bool `yaml:"isDistributedMod"` } `yaml:"minio"` }