feat: add aliyun oss storage foundation

This commit is contained in:
xiong
2026-07-26 14:43:04 +08:00
parent 47613b51bd
commit c6051f95f2
13 changed files with 969 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
namespace Tiku.Infrastructure.Storage;
public sealed class ObjectStorageOptions
{
public const string SectionName = "Storage";
public string DefaultProvider { get; set; } = "local_dev";
public string DefaultBucket { get; set; } = "tenant-assets";
public string? PublicBaseUrl { get; set; }
public long MaxUploadBytes { get; set; } = 1024L * 1024 * 500;
public string[] AllowedMimePrefixes { get; set; } = ["image/", "video/", "audio/"];
public string[] AllowedMimeTypes { get; set; } =
[
"application/pdf",
"application/json",
"text/csv",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
];
public bool RequireTenantPrefix { get; set; } = true;
public static bool BeValid(ObjectStorageOptions options) =>
options.MaxUploadBytes > 0 &&
!string.IsNullOrWhiteSpace(options.DefaultProvider) &&
!string.IsNullOrWhiteSpace(options.DefaultBucket);
}