feat: load oss media config from sys config

This commit is contained in:
richjohnrambo
2026-09-08 22:19:00 +08:00
parent 0f984b0ab4
commit aae13c9265
10 changed files with 224 additions and 9 deletions
+10
View File
@@ -57,6 +57,10 @@ func TestLoadSysConfig(t *testing.T) {
"oss_access_key_id": "ak",
"oss_access_key_secret": "sk",
"oss_presign_ttl": "300",
"oss_serve_url": "/files/",
"oss_cache_control": "private",
"oss_cors_origins": `["https://example.com"]`,
"oss_verify_bucket": "true",
}
defer func() { store.ThirdPartyConfig = original }()
@@ -70,4 +74,10 @@ func TestLoadSysConfig(t *testing.T) {
if handler.conf.RegionID != "cn-shenzhen" || handler.conf.PresignTTL != 300 {
t.Fatalf("unexpected OSS region or ttl: %+v", handler.conf)
}
if handler.conf.ServeURL != "/files/" || handler.conf.CacheControl != "private" || !handler.conf.VerifyBucket {
t.Fatalf("unexpected OSS serve settings: %+v", handler.conf)
}
if len(handler.conf.CorsOrigins) != 1 || handler.conf.CorsOrigins[0] != "https://example.com" {
t.Fatalf("unexpected OSS cors origins: %+v", handler.conf.CorsOrigins)
}
}