65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IM.InitCommon
|
|
{
|
|
public class StorageOptions
|
|
{
|
|
public string DefaultProviderCode { get; set; }
|
|
public Dictionary<string, StorageProviderOptions> Providers { get; set; }
|
|
}
|
|
|
|
public class StorageProviderOptions
|
|
{
|
|
public string ProviderCode { get; init; } = default!;
|
|
|
|
public StorageProviderType ProviderType { get; init; }
|
|
|
|
public bool Enabled { get; init; } = true;
|
|
|
|
public string Bucket { get; init; } = default!;
|
|
|
|
/// <summary>
|
|
/// 公开读桶名;Local provider 下作为 public 目录名使用。
|
|
/// 文件所在 Bucket == PublicBucket 即视为公开,可生成直链。
|
|
/// </summary>
|
|
public string? PublicBucket { get; init; }
|
|
|
|
public string Region { get; init; } = default!;
|
|
|
|
public string? Endpoint { get; init; }
|
|
|
|
public string? PublicBaseUrl { get; init; }
|
|
|
|
public string? AccessKeyId { get; init; }
|
|
|
|
public string? AccessKeySecret { get; init; }
|
|
|
|
public string? LocalRootPath { get; init; }
|
|
|
|
public string? LocalUploadApiBaseUrl { get; init; }
|
|
|
|
public TimeSpan UploadUrlExpiresIn { get; init; } = TimeSpan.FromMinutes(15);
|
|
|
|
public TimeSpan DownloadUrlExpiresIn { get; init; } = TimeSpan.FromMinutes(30);
|
|
|
|
public long MaxObjectSizeBytes { get; init; } = 1024L * 1024 * 1024;
|
|
|
|
public long MinPartSizeBytes { get; init; } = 5 * 1024 * 1024;
|
|
public long DefaultPartSizeBytes { get; init; } = 5 * 1024 * 1024;
|
|
|
|
public int MaxPartCount { get; init; } = 10_000;
|
|
}
|
|
public enum StorageProviderType
|
|
{
|
|
Local = 1,
|
|
AwsS3 = 2,
|
|
AliyunOss = 3,
|
|
TencentCos = 4,
|
|
Minio = 5
|
|
}
|
|
}
|