feat(storage): add dynamic storage config and migration

Move storage backend configuration from startup YAML to system_config-backed runtime configuration. Add local, S3-compatible, R2, MinIO, OSS, and WebDAV backend support.

Add a storage migration async task using the existing task dispatch framework. Migration target config is carried in task payload, and maintenance mode is derived from task execution state.

Split upload file management and storage operations, add the admin storage configuration tab, and update migrations and Swagger docs.
This commit is contained in:
ryan
2026-06-13 14:55:15 +08:00
parent 4bf8a4806e
commit 9a18bea324
46 changed files with 2005 additions and 743 deletions
@@ -155,8 +155,6 @@ export class AdminService extends BaseService {
return this.get<string[]>('/uploads/types');
}
// ==================== 认证源管理 ====================
static async listAuthSources(): Promise<AuthSource[]> {
+29 -2
View File
@@ -26,7 +26,7 @@ export interface SystemConfig {
export interface CreateSystemConfigRequest {
/** 配置键(最大64字符) */
key: string;
/** 配置值(最大255字符) */
/** 配置值 */
value: string;
/** 配置类型:'system' | 'business' */
type: 'system' | 'business';
@@ -40,7 +40,7 @@ export interface CreateSystemConfigRequest {
* 更新系统配置请求参数
*/
export interface UpdateSystemConfigRequest {
/** 配置值(最大255字符) */
/** 配置值 */
value: string;
/** 是否对公共配置接口可见:0 不可见,1 可见 */
visibility?: 0 | 1;
@@ -48,7 +48,34 @@ export interface UpdateSystemConfigRequest {
description?: string;
}
export type StorageDriver = 'local' | 's3' | 'r2' | 'minio' | 'oss' | 'webdav';
export interface ObjectStorageConfig {
endpoint: string;
region: string;
bucket: string;
access_key_id: string;
secret_access_key: string;
account_id?: string;
path_style: boolean;
key_prefix: string;
cdn_url: string;
}
export interface StorageConfig {
driver: StorageDriver;
local: { root: string };
s3: ObjectStorageConfig;
r2: ObjectStorageConfig;
minio: ObjectStorageConfig;
oss: ObjectStorageConfig;
webdav: {
endpoint: string;
username: string;
password: string;
base_path: string;
};
}
// ==================== 任务管理 ====================