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.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
/// 上传文件的容器
/// </summary>
/// <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 =>
{
options.Containers.Configure<MyFileContainer>(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;
});
});
});

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;",
"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": {

14
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<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>();
//Configure<AbpAutoMapperOptions>(options =>
//{

Loading…
Cancel
Save