feat: finalize core modules and gateway
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using TakeoutSaaS.Module.Storage.Abstractions;
|
||||
using TakeoutSaaS.Module.Storage.Options;
|
||||
using TakeoutSaaS.Module.Storage.Providers;
|
||||
using TakeoutSaaS.Module.Storage.Services;
|
||||
|
||||
namespace TakeoutSaaS.Module.Storage.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// 存储模块服务注册扩展。
|
||||
/// </summary>
|
||||
public static class StorageServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册存储模块所需的提供商与配置。
|
||||
/// </summary>
|
||||
/// <param name="services">服务集合。</param>
|
||||
/// <param name="configuration">配置源。</param>
|
||||
public static IServiceCollection AddStorageModule(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddOptions<StorageOptions>()
|
||||
.Bind(configuration.GetSection("Storage"))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
services.AddSingleton<IObjectStorageProvider, TencentCosStorageProvider>();
|
||||
services.AddSingleton<IObjectStorageProvider, QiniuKodoStorageProvider>();
|
||||
services.AddSingleton<IObjectStorageProvider, AliyunOssStorageProvider>();
|
||||
services.AddSingleton<IStorageProviderResolver, StorageProviderResolver>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user