Exemple #1
0
        public SingleBucketFileStorageService(
            string bucket,
            string endpoint,
            string?publicEndpoint,
            string accessKey,
            string secretKey,
            bool hasSsl,
            bool hasPublicSsl,
            ILogger <SingleBucketFileStorageService> logger,
            MinioRequestLogger?minioRequestLogger
            )
        {
            client = new Minio.MinioClient(endpoint, accessKey, secretKey);
            client.SetTraceOn(minioRequestLogger);
            if (hasSsl)
            {
                client = client.WithSSL();
            }
            this.bucket         = bucket;
            this.endpoint       = endpoint;
            this.publicEndpoint = publicEndpoint;
            var endpointUri = new UriBuilder(publicEndpoint ?? this.endpoint);

            if (endpointUri.Host == null || endpointUri.Host == "" || endpointUri.Scheme != null || endpointUri.Scheme != "")
            {
            }
            else
            {
                endpointUri.Scheme = hasPublicSsl ? "https" : "http";
            }
            this.publicEndpointUri = new Uri(endpointUri.Uri, bucket + "/");
            logger.LogInformation("Set up public endpoint as {0}", publicEndpointUri.ToString());
            this.hasSsl = hasSsl;
            this.logger = logger;
        }
Exemple #2
0
        private static MinioClient CreateMiniotClient_(S3StorageConfig s3Config)
        {
            var minioClient = new Minio.MinioClient(
                s3Config.Provider.EndPoint,
                s3Config.AccessKey,
                s3Config.SecretKey
                );

            if (s3Config.Proxies.Any())
            {
                var proxyInfo = s3Config.Proxies.First();
                minioClient.WithProxy(proxyInfo.CreateWebProxy());
            }
            clientDict_.Add(s3Config.Provider, minioClient);

            #if RELEASE
            return(minioClient.WithSSL());
            #else
            return(minioClient);
            #endif
        }