mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
support notes for config
This commit is contained in:
@@ -2,6 +2,7 @@ package conf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/InazumaV/V2bX/common/json5"
|
||||
"os"
|
||||
|
||||
"github.com/goccy/go-json"
|
||||
@@ -28,5 +29,5 @@ func (p *Conf) LoadFromPath(filePath string) error {
|
||||
return fmt.Errorf("open config file error: %s", err)
|
||||
}
|
||||
defer f.Close()
|
||||
return json.NewDecoder(f).Decode(p)
|
||||
return json.NewDecoder(json5.NewTrimNodeReader(f)).Decode(p)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
func TestConf_LoadFromPath(t *testing.T) {
|
||||
c := New()
|
||||
t.Log(c.LoadFromPath("./config.json"), c.NodeConfig)
|
||||
t.Log(c.LoadFromPath("../example/config.json"), c.NodeConfig)
|
||||
}
|
||||
|
||||
func TestConf_Watch(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user