mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	优化API配置格式化
This commit is contained in:
		@@ -14,9 +14,9 @@ type APIConfig struct {
 | 
				
			|||||||
	OldRPC struct {
 | 
						OldRPC struct {
 | 
				
			||||||
		Endpoints     []string `yaml:"endpoints" json:"endpoints"`
 | 
							Endpoints     []string `yaml:"endpoints" json:"endpoints"`
 | 
				
			||||||
		DisableUpdate bool     `yaml:"disableUpdate" json:"disableUpdate"`
 | 
							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"`
 | 
						RPCDisableUpdate bool     `yaml:"rpc.disableUpdate" json:"rpc.disableUpdate"`
 | 
				
			||||||
	NodeId           string   `yaml:"nodeId" json:"nodeId"`
 | 
						NodeId           string   `yaml:"nodeId" json:"nodeId"`
 | 
				
			||||||
	Secret           string   `yaml:"secret" json:"secret"`
 | 
						Secret           string   `yaml:"secret" json:"secret"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package configs_test
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeNode/internal/configs"
 | 
						"github.com/TeaOSLab/EdgeNode/internal/configs"
 | 
				
			||||||
	_ "github.com/iwind/TeaGo/bootstrap"
 | 
						_ "github.com/iwind/TeaGo/bootstrap"
 | 
				
			||||||
 | 
						"gopkg.in/yaml.v3"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -12,4 +13,10 @@ func TestLoadAPIConfig(t *testing.T) {
 | 
				
			|||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	t.Logf("%+v", config)
 | 
						t.Logf("%+v", config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						configData, err := yaml.Marshal(config)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						t.Log(string(configData))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user