信任证书
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
5a27fbc127
commit
c72f50c1f7
|
|
@ -527,40 +527,47 @@ public class OSSService : IOSSService
|
|||
}
|
||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
||||
{
|
||||
|
||||
var httpClientHandler = new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
|
||||
};
|
||||
|
||||
var minIOConfig = ObjectStoreServiceOptions.MinIO;
|
||||
|
||||
var minioClient = new MinioClient()
|
||||
.WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
|
||||
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey)
|
||||
.WithSSL(minIOConfig.UseSSL)
|
||||
.WithHttpClient(new HttpClient(httpClientHandler))
|
||||
.Build();
|
||||
|
||||
#region 废弃3
|
||||
|
||||
//var pipe = new System.IO.Pipelines.Pipe();
|
||||
var pipe = new System.IO.Pipelines.Pipe();
|
||||
|
||||
//_ = Task.Run(async () =>
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var args = new GetObjectArgs()
|
||||
// .WithBucket(minIOConfig.BucketName)
|
||||
// .WithObject(ossRelativePath)
|
||||
// .WithCallbackStream(async source =>
|
||||
// {
|
||||
// await source.CopyToAsync(pipe.Writer.AsStream());
|
||||
// await pipe.Writer.FlushAsync();
|
||||
// });
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var args = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(async source =>
|
||||
{
|
||||
await source.CopyToAsync(pipe.Writer.AsStream());
|
||||
await pipe.Writer.FlushAsync();
|
||||
});
|
||||
|
||||
// await minioClient.GetObjectAsync(args);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// await pipe.Writer.CompleteAsync();
|
||||
// }
|
||||
//});
|
||||
await minioClient.GetObjectAsync(args);
|
||||
}
|
||||
finally
|
||||
{
|
||||
await pipe.Writer.CompleteAsync();
|
||||
}
|
||||
});
|
||||
|
||||
//return pipe.Reader.AsStream();
|
||||
return pipe.Reader.AsStream();
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -599,16 +606,16 @@ public class OSSService : IOSSService
|
|||
|
||||
#region 废弃
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
//var memoryStream = new MemoryStream();
|
||||
|
||||
var getObjectArgs = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
|
||||
//var getObjectArgs = new GetObjectArgs()
|
||||
// .WithBucket(minIOConfig.BucketName)
|
||||
// .WithObject(ossRelativePath)
|
||||
// .WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
|
||||
|
||||
await minioClient.GetObjectAsync(getObjectArgs);
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
//await minioClient.GetObjectAsync(getObjectArgs);
|
||||
//memoryStream.Position = 0;
|
||||
//return memoryStream;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue