pull/261/head
wangchuxiao 3 years ago
parent ef9c291d9a
commit 9136838b63

@ -48,7 +48,9 @@ func MinioInit() {
} }
opt := minio.MakeBucketOptions{ opt := minio.MakeBucketOptions{
Region: config.Config.Credential.Minio.Location, Region: config.Config.Credential.Minio.Location,
ObjectLocking: false, }
if config.Config.Credential.Minio.IsDistributedMod == true {
opt.ObjectLocking = true
} }
err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt) err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt)
if err != nil { if err != nil {

@ -161,6 +161,7 @@ func MinioStorageCredential(c *gin.Context) {
resp.BucketName = config.Config.Credential.Minio.Bucket resp.BucketName = config.Config.Credential.Minio.Bucket
resp.StsEndpointURL = config.Config.Credential.Minio.Endpoint resp.StsEndpointURL = config.Config.Credential.Minio.Endpoint
resp.StorageTime = config.Config.Credential.Minio.StorageTime 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}) c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
} }

@ -13,6 +13,7 @@ type MiniostorageCredentialResp struct {
BucketName string `json:"bucketName"` BucketName string `json:"bucketName"`
StsEndpointURL string `json:"stsEndpointURL"` StsEndpointURL string `json:"stsEndpointURL"`
StorageTime int `json:"storageTime"` StorageTime int `json:"storageTime"`
IsDistributedMod bool `json:"isDistributedMod"`
} }
type MinioUploadFileReq struct { type MinioUploadFileReq struct {

@ -72,6 +72,7 @@ type config struct {
EndpointInner string `yaml:"endpointInner"` EndpointInner string `yaml:"endpointInner"`
EndpointInnerEnable bool `yaml:"endpointInnerEnable"` EndpointInnerEnable bool `yaml:"endpointInnerEnable"`
StorageTime int `yaml:"storageTime"` StorageTime int `yaml:"storageTime"`
IsDistributedMod bool `yaml:"isDistributedMod"`
} `yaml:"minio"` } `yaml:"minio"`
} }

Loading…
Cancel
Save