23 lines
810 B
C#
23 lines
810 B
C#
using log4net;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Minio;
|
|
|
|
namespace Bunny.Common.Context.Middleware;
|
|
|
|
public static class MinioContext
|
|
{
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(MinioContext));
|
|
public static IMinioClient? MinioClient;
|
|
public static readonly string BucketName = AppSettings.GetConfig("Minio:BucketName");
|
|
|
|
public static void AddMinioContext(this WebApplicationBuilder builder)
|
|
{
|
|
var endpoint = AppSettings.GetConfig("Minio:Url");
|
|
var accessKey = AppSettings.GetConfig("Minio:AccessKey");
|
|
var secretKey = AppSettings.GetConfig("Minio:SecretKey");
|
|
|
|
MinioClient = new MinioClient().WithEndpoint(endpoint).WithCredentials(accessKey, secretKey)
|
|
// .WithSSL() // 使用HTTPS
|
|
.Build();
|
|
}
|
|
} |