コード例 #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;
        }