Browse Source

切换到MinIO文件存储

master
wanggang 1 year ago
parent
commit
22008daec3
  1. 34
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  2. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  3. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

34
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.BackgroundJobs.Hangfire;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem; using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.BlobStoring.Minio;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EntityFrameworkCore.SqlServer;
@ -162,20 +163,35 @@ namespace Win.Sfs.SettleAccount
/// 上传文件的容器 /// 上传文件的容器
/// </summary> /// </summary>
/// <param name="context"></param> /// <param name="context"></param>
private void ConfigureBLOBServices(IConfiguration configPath) private void ConfigureBLOBServices(IConfiguration cfg)
{ {
//Configure<AbpBlobStoringOptions>(options =>
//{
// options.Containers.Configure<MyFileContainer>(configuration =>
// {
// configuration.UseFileSystem(fileSystem =>
// {
// var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files";
// if (!Directory.Exists(filestreampath))
// {
// Directory.CreateDirectory(filestreampath);
// }
// fileSystem.BasePath = filestreampath;
// });
// });
//});
Configure<AbpBlobStoringOptions>(options => Configure<AbpBlobStoringOptions>(options =>
{ {
options.Containers.Configure<MyFileContainer>(configuration => options.Containers.ConfigureDefault(container =>
{ {
configuration.UseFileSystem(fileSystem => container.UseMinio(minio =>
{ {
var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files"; minio.EndPoint = cfg.GetValue("MinIO:EndPoint", "localhost:10684");
if (!Directory.Exists(filestreampath)) minio.AccessKey = cfg.GetValue("MinIO:AccessKey", "g0GKnhRGEQHI0uiGBYre");
{ minio.SecretKey = cfg.GetValue("MinIO:SecretKey", "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv");
Directory.CreateDirectory(filestreampath); minio.BucketName = cfg.GetValue("MinIO:BucketName", "default");
} minio.WithSSL = false;
fileSystem.BasePath = filestreampath;
}); });
}); });
}); });

6
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;", "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;" "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": { "Serilog": {
"Using": [], "Using": [],
"MinumumLevel": { "MinumumLevel": {

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -33,20 +33,6 @@ namespace Win.Sfs.SettleAccount
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var cfg = context.Services.GetConfiguration();
//Configure<AbpBlobStoringOptions>(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<SettleAccountApplicationModule>(); //context.Services.AddAutoMapperObjectMapper<SettleAccountApplicationModule>();
//Configure<AbpAutoMapperOptions>(options => //Configure<AbpAutoMapperOptions>(options =>
//{ //{

Loading…
Cancel
Save