forked from xiongyuxing/tiku-backend.net
feat: add aliyun oss storage foundation
This commit is contained in:
28
Tiku.Infrastructure/Storage/ObjectStorageOptions.cs
Normal file
28
Tiku.Infrastructure/Storage/ObjectStorageOptions.cs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user