fix: 修复管理端媒体配置解析 (#72)

This commit is contained in:
ila
2026-08-27 10:10:24 +08:00
parent 71c7142f0c
commit 5428ad2b9e
3 changed files with 21 additions and 5 deletions
+4 -4
View File
@@ -10,14 +10,14 @@ var ExtConfig Extend
//
// 使用方法: config.ExtConfig......即可!!
type Extend struct {
AMap AMap `yaml:"amap"`
Chorus Chorus `yaml:"chorus"`
AMap AMap `json:"amap" yaml:"amap"`
Chorus Chorus `json:"chorus" yaml:"chorus"`
}
type AMap struct {
Key string `yaml:"key"`
Key string `json:"key" yaml:"key"`
}
type Chorus struct {
StorageRoot string `yaml:"storage_root"`
StorageRoot string `json:"storage_root" yaml:"storage_root"`
}
+16
View File
@@ -0,0 +1,16 @@
package config
import (
"encoding/json"
"testing"
)
func TestExtendDecodesStorageRootFromGoAdminJSONReader(t *testing.T) {
var config Extend
if err := json.Unmarshal([]byte(`{"chorus":{"storage_root":"../var/storage"}}`), &config); err != nil {
t.Fatal(err)
}
if config.Chorus.StorageRoot != "../var/storage" {
t.Fatalf("storage root = %q", config.Chorus.StorageRoot)
}
}
+1 -1
View File
@@ -24,4 +24,4 @@ settings:
extend:
chorus:
# Read-only access to the same protected storage root used by Portal.
storage_root: ../var/storage
storage_root: ../var/storage