From 61951863ad06b4fd1fad382d3ad34ce0e8f2c7b1 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 30 Jun 2022 10:24:47 +0800 Subject: [PATCH] minio --- internal/api/third/minio_init.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/internal/api/third/minio_init.go b/internal/api/third/minio_init.go index 29b91b952..051267d64 100644 --- a/internal/api/third/minio_init.go +++ b/internal/api/third/minio_init.go @@ -80,10 +80,23 @@ func MinioInit() { } // 自动化桶public的代码 err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite) + if err != nil { + log.NewInfo("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error()) + } err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.AppBucket, policy.BucketPolicyReadWrite) if err != nil { - log.NewDebug("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error()) - return + log.NewInfo("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error()) + } + policyType, err := MinioClient.GetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket) + if err != nil { + log.NewInfo("", utils.GetSelfFuncName(), err.Error()) + } + log.NewInfo("", utils.GetSelfFuncName(), "policy: ", policyType) + policyType, err = MinioClient.GetBucketPolicy(context.Background(), config.Config.Credential.Minio.AppBucket) + if err != nil { + log.NewInfo("", utils.GetSelfFuncName(), err.Error()) } + log.NewInfo("", utils.GetSelfFuncName(), "policy: ", policyType) + log.NewInfo(operationID, utils.GetSelfFuncName(), "minio create and set policy success") }