Browse Source

Merge pull request #1383 from colinin/use-oss-provider-with-config

feat(platform-service): Use object storage through configuration
pull/1384/head
yx lin 3 months ago
committed by GitHub
parent
commit
215feb2b90
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj
  2. 35
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs
  3. 12
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs

3
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj

@ -64,12 +64,15 @@
<ProjectReference Include="..\..\migrations\LY.MicroService.Platform.EntityFrameworkCore\LY.MicroService.Platform.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Aliyun\LINGYUN.Abp.OssManagement.Aliyun.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Application\LINGYUN.Abp.OssManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.FileSystem\LINGYUN.Abp.OssManagement.FileSystem.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.HttpApi\LINGYUN.Abp.OssManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Imaging\LINGYUN.Abp.OssManagement.Imaging.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Minio\LINGYUN.Abp.OssManagement.Minio.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Nexus\LINGYUN.Abp.OssManagement.Nexus.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.SettingManagement\LINGYUN.Abp.OssManagement.SettingManagement.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Tencent\LINGYUN.Abp.OssManagement.Tencent.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.UI.Navigation.VueVbenAdmin5\LINGYUN.Abp.UI.Navigation.VueVbenAdmin5.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Application\LINGYUN.Platform.Application.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.EntityFrameworkCore\LINGYUN.Platform.EntityFrameworkCore.csproj" />

35
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs

@ -141,41 +141,6 @@ public partial class PlatformManagementHttpApiHostModule
});
}
private void ConfigureOssManagement(IServiceCollection services, IConfiguration configuration)
{
var useMinio = configuration.GetValue<bool>("OssManagement:UseMinio");
if (useMinio)
{
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureAll((containerName, containerConfiguration) =>
{
containerConfiguration.UseMinio(minio =>
{
configuration.GetSection("Minio").Bind(minio);
});
});
});
services.AddMinioContainer();
}
else
{
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureAll((containerName, containerConfiguration) =>
{
containerConfiguration.UseFileSystem(fileSystem =>
{
fileSystem.BasePath = Path.Combine(
Directory.GetCurrentDirectory(),
configuration["OssManagement:Bucket"] ?? "blobs");
});
});
});
services.AddFileSystemContainer();
}
}
private void ConfigureExceptionHandling()
{
// 自定义需要处理的异常

12
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs

@ -13,10 +13,13 @@ using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.Notifications;
using LINGYUN.Abp.OssManagement;
using LINGYUN.Abp.OssManagement.Aliyun;
using LINGYUN.Abp.OssManagement.FileSystem;
using LINGYUN.Abp.OssManagement.Imaging;
using LINGYUN.Abp.OssManagement.Minio;
using LINGYUN.Abp.OssManagement.Nexus;
using LINGYUN.Abp.OssManagement.SettingManagement;
using LINGYUN.Abp.OssManagement.Tencent;
using LINGYUN.Abp.Saas.EntityFrameworkCore;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
@ -67,9 +70,11 @@ namespace LY.MicroService.PlatformManagement;
typeof(AbpAspNetCoreMvcLocalizationModule),
typeof(AbpUINavigationVueVbenAdmin5Module),
typeof(PlatformThemeVueVbenAdminModule),
// typeof(AbpOssManagementAliyunModule),
typeof(AbpOssManagementMinioModule), // Minio存储提供者模块
typeof(AbpOssManagementFileSystemModule), // 本地文件系统提供者模块
typeof(AbpOssManagementAliyunModule), // 阿里云存储提供者模块
typeof(AbpOssManagementTencentModule), // 腾讯云存储提供者模块
typeof(AbpOssManagementNexusModule), // Nexus存储提供者模块
typeof(AbpOssManagementMinioModule), // Minio存储提供者模块
typeof(AbpOssManagementFileSystemModule),// 本地文件系统提供者模块
typeof(AbpOssManagementImagingModule), // 对象存储图形处理模块
typeof(AbpOssManagementApplicationModule),
typeof(AbpOssManagementHttpApiModule),
@ -142,7 +147,6 @@ public partial class PlatformManagementHttpApiHostModule : AbpModule
ConfigureMvc(context.Services, configuration);
ConfigureCors(context.Services, configuration);
ConfigureSwagger(context.Services, configuration);
ConfigureOssManagement(context.Services, configuration);
ConfigureDistributedLocking(context.Services, configuration);
ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment());
ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment());

Loading…
Cancel
Save