feat(storage): 为 Minio 存储添加版本检查跳过选项

This commit is contained in:
xiandan 2025-01-09 17:52:09 +08:00
parent 88366f280e
commit 0f6acdb1fd
2 changed files with 4 additions and 1 deletions

View File

@ -52,6 +52,7 @@ type MinioStorageConfig struct {
ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"`
ServeDirect bool `ini:"SERVE_DIRECT"`
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE" json:",omitempty"`
SkipVersionCheck bool `ini:"SKIP_VERSION_CHECK" json:",omitempty"`
}
func (cfg *MinioStorageConfig) ToShadow() {

View File

@ -112,7 +112,9 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
// Otherwise even if the request itself fails (403, 404, etc), the code should still continue because the parameters seem "good" enough.
// Keep in mind that GetBucketVersioning requires "owner" to really succeed, so it can't be used to check the existence.
// Not using "BucketExists (HeadBucket)" because it doesn't include detailed failure reasons.
err = getBucketVersioning(ctx, minioClient, config.Bucket)
if !config.SkipVersionCheck {
err = getBucketVersioning(ctx, minioClient, config.Bucket)
}
if err != nil {
errResp, ok := err.(minio.ErrorResponse)
if !ok {