From 22008daec32b457f498d925dd2189623e950139e Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 29 Aug 2023 15:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=B0MinIO=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettleAccountHttpApiHostModule.cs | 34 ++++++++++++++----- .../appsettings.json | 6 ++++ .../SettleAccountApplicationModule.cs | 14 -------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs index 8f89516a..bf0c7668 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs @@ -26,6 +26,7 @@ using Volo.Abp.Autofac; using Volo.Abp.BackgroundJobs.Hangfire; using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring.FileSystem; +using Volo.Abp.BlobStoring.Minio; using Volo.Abp.Caching; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore.SqlServer; @@ -162,20 +163,35 @@ namespace Win.Sfs.SettleAccount /// 上传文件的容器 /// /// - private void ConfigureBLOBServices(IConfiguration configPath) + private void ConfigureBLOBServices(IConfiguration cfg) { + //Configure(options => + //{ + // options.Containers.Configure(configuration => + // { + // configuration.UseFileSystem(fileSystem => + // { + // var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files"; + // if (!Directory.Exists(filestreampath)) + // { + // Directory.CreateDirectory(filestreampath); + // } + // fileSystem.BasePath = filestreampath; + // }); + // }); + //}); + Configure(options => { - options.Containers.Configure(configuration => + options.Containers.ConfigureDefault(container => { - configuration.UseFileSystem(fileSystem => + container.UseMinio(minio => { - var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files"; - if (!Directory.Exists(filestreampath)) - { - Directory.CreateDirectory(filestreampath); - } - fileSystem.BasePath = filestreampath; + minio.EndPoint = cfg.GetValue("MinIO:EndPoint", "localhost:10684"); + minio.AccessKey = cfg.GetValue("MinIO:AccessKey", "g0GKnhRGEQHI0uiGBYre"); + minio.SecretKey = cfg.GetValue("MinIO:SecretKey", "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); + minio.BucketName = cfg.GetValue("MinIO:BucketName", "default"); + minio.WithSSL = false; }); }); }); diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index b3fef962..18cbf47d 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -8,6 +8,12 @@ "WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", "questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" }, + "MinIO": { + "EndPoint": "dev.ccwin-in.com:16084", + "AccessKey": "g0GKnhRGEQHI0uiGBYre", + "SecretKey": "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv", + "BucketName": "default" + }, "Serilog": { "Using": [], "MinumumLevel": { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs index 2e394214..0030ff59 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs @@ -33,20 +33,6 @@ namespace Win.Sfs.SettleAccount { public override void ConfigureServices(ServiceConfigurationContext context) { - var cfg = context.Services.GetConfiguration(); - //Configure(options => - //{ - // options.Containers.ConfigureDefault(container => - // { - // container.UseMinio(minio => - // { - // minio.EndPoint = cfg.GetValue("MinIO:EndPoint", ""); - // minio.AccessKey = cfg.GetValue("MinIO:AccessKey", ""); - // minio.SecretKey = cfg.GetValue("MinIO:SecretKey", ""); - // minio.BucketName = cfg.GetValue("MinIO:BucketName", ""); - // }); - // }); - //}); //context.Services.AddAutoMapperObjectMapper(); //Configure(options => //{