You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.1 KiB
2.1 KiB
LINGYUN.Abp.BlobStoring.OssManagement
abp框架对象存储提供者IBlobProvider的Oss管理模块实现
配置使用
模块按需引用, 依赖于OssManagement模块, 所以需要配置远端Oss管理模块的客户端代理
事先定义appsettings.json文件
{
"OssManagement": {
"Bucket": "你定义的BucketName"
},
"RemoteServices": {
"AbpOssManagement": {
"BaseUrl": "http://127.0.0.1:30025",
"IdentityClient": "InternalServiceClient",
"UseCurrentAccessToken": false
}
},
"IdentityClients": {
"InternalServiceClient": {
"Authority": "http://127.0.0.1:44385",
"RequireHttps": false,
"GrantType": "client_credentials",
"Scope": "lingyun-abp-application",
"ClientId": "InternalServiceClient",
"ClientSecret": "1q2w3E*"
}
}
}
[DependsOn(typeof(AbpBlobStoringOssManagementModule))]
public class YouProjectModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var preActions = context.Services.GetPreConfigureActions<AbpBlobStoringOptions>();
Configure<AbpBlobStoringOptions>(options =>
{
preActions.Configure(options);
// YouContainer use oss management
options.Containers.Configure<YouContainer>((containerConfiguration) =>
{
containerConfiguration.UseOssManagement(config =>
{
config.Bucket = configuration[OssManagementBlobProviderConfigurationNames.Bucket];
});
});
// all container use oss management
options.Containers.ConfigureAll((containerName, containerConfiguration) =>
{
// use oss management
containerConfiguration.UseOssManagement(config =>
{
config.Bucket = configuration[OssManagementBlobProviderConfigurationNames.Bucket];
});
});
});
}
}