2020IP / TwentyTwenty.Storage

A cross-cloud storage abstraction
Other
100 stars 26 forks source link

compatible with MinIO server #42

Open mirror222 opened 1 year ago

mirror222 commented 1 year ago
        public AmazonStorageProvider(AmazonProviderOptions options)
        {
            _serviceUrl = string.IsNullOrEmpty(options.ServiceUrl) ? DefaultServiceUrl : options.ServiceUrl;
            _bucket = options.Bucket;
            _serverSideEncryptionMethod = options.ServerSideEncryptionMethod;
            _chunkedThreshold = options.ChunkedUploadThreshold;

            var S3Config = new AmazonS3Config
            {
                ServiceURL = _serviceUrl,
                Timeout = options.Timeout ?? ClientConfig.MaxTimeout,
                // adding ForcePathStyle = true to compatible with MinIO server
                ForcePathStyle = !string.IsNullOrEmpty(options.ServiceUrl),
            };

            _s3Client = new AmazonS3Client(ReadAwsCredentials(options), S3Config);
        }
zabulus commented 1 year ago

+1 for this issue. I propose even to go further. Allow end-user to specify Action<AmazonS3Config> to make custom configuration of AmazonS3Config.