From cb4d2ab7d7cba4eb0324d662df3c0988f6728297 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sat, 12 Aug 2023 18:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96API=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/configs/api_config.go | 4 ++-- internal/configs/api_config_test.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/configs/api_config.go b/internal/configs/api_config.go index 699ca20..a7f9f2a 100644 --- a/internal/configs/api_config.go +++ b/internal/configs/api_config.go @@ -14,9 +14,9 @@ type APIConfig struct { OldRPC struct { Endpoints []string `yaml:"endpoints" json:"endpoints"` DisableUpdate bool `yaml:"disableUpdate" json:"disableUpdate"` - } `yaml:"rpc" json:"rpc"` + } `yaml:"rpc,omitempty" json:"rpc"` - RPCEndpoints []string `yaml:"rpc.endpoints" json:"rpc.endpoints"` + RPCEndpoints []string `yaml:"rpc.endpoints,flow" json:"rpc.endpoints"` RPCDisableUpdate bool `yaml:"rpc.disableUpdate" json:"rpc.disableUpdate"` NodeId string `yaml:"nodeId" json:"nodeId"` Secret string `yaml:"secret" json:"secret"` diff --git a/internal/configs/api_config_test.go b/internal/configs/api_config_test.go index d1c4bfb..e6efe20 100644 --- a/internal/configs/api_config_test.go +++ b/internal/configs/api_config_test.go @@ -3,6 +3,7 @@ package configs_test import ( "github.com/TeaOSLab/EdgeNode/internal/configs" _ "github.com/iwind/TeaGo/bootstrap" + "gopkg.in/yaml.v3" "testing" ) @@ -12,4 +13,10 @@ func TestLoadAPIConfig(t *testing.T) { t.Fatal(err) } t.Logf("%+v", config) + + configData, err := yaml.Marshal(config) + if err != nil { + t.Fatal(err) + } + t.Log(string(configData)) }