mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 00:56:37 +08:00
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:
@@ -155,8 +155,6 @@ export class AdminService extends BaseService {
|
||||
return this.get<string[]>('/uploads/types');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==================== 认证源管理 ====================
|
||||
|
||||
static async listAuthSources(): Promise<AuthSource[]> {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
// ==================== 任务管理 ====================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user