fix: 修复管理端媒体配置解析 (#72)
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user