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
-10
View File
@@ -224,16 +224,6 @@ func applyEnvOverrides(c *configModel) {
// ─── OTel ───
c.Otel.SamplingRate = envFloat64("OTEL_SAMPLING_RATE", c.Otel.SamplingRate)
// ─── S3 ───
c.S3.Endpoint = envStr("S3_ENDPOINT", c.S3.Endpoint)
c.S3.Region = envStr("S3_REGION", c.S3.Region)
c.S3.Bucket = envStr("S3_BUCKET", c.S3.Bucket)
c.S3.AccessKeyID = envStr("S3_ACCESS_KEY_ID", c.S3.AccessKeyID)
c.S3.SecretAccessKey = envStr("S3_SECRET_ACCESS_KEY", c.S3.SecretAccessKey)
c.S3.CdnURL = envStr("S3_CDN_URL", c.S3.CdnURL)
c.S3.PathStyle = envBool("S3_PATH_STYLE", c.S3.PathStyle)
c.S3.Enabled = envBool("S3_ENABLED", c.S3.Enabled)
// ─── Worker ───
c.Worker.Concurrency = envInt("WORKER_CONCURRENCY", c.Worker.Concurrency)
c.Worker.StrictPriority = envBool("WORKER_STRICT_PRIORITY", c.Worker.StrictPriority)
-20
View File
@@ -15,7 +15,6 @@ type configModel struct {
Worker workerConfig `mapstructure:"worker"`
ClickHouse clickHouseConfig `mapstructure:"clickhouse"`
Otel otelConfig `mapstructure:"otel"`
S3 s3Config `mapstructure:"s3"`
}
// appConfig 应用基本配置
@@ -139,22 +138,3 @@ type QueueConfig struct {
type otelConfig struct {
SamplingRate float64 `mapstructure:"sampling_rate"`
}
// s3Config S3 compatible storage configuration
type s3Config struct {
Enabled bool `mapstructure:"enabled"`
Endpoint string `mapstructure:"endpoint"`
Region string `mapstructure:"region"`
Bucket string `mapstructure:"bucket"`
AccessKeyID string `mapstructure:"access_key_id" json:"-"`
SecretAccessKey string `mapstructure:"secret_access_key" json:"-"`
PathStyle bool `mapstructure:"path_style"`
KeyPrefix string `mapstructure:"key_prefix"`
CdnURL string `mapstructure:"cdn_url"`
LocalCache localCacheConfig `mapstructure:"local_cache"`
}
type localCacheConfig struct {
Enabled bool `mapstructure:"enabled"`
CacheDir string `mapstructure:"cache_dir"`
}