启动的时候尝试从备份文件中恢复配置

This commit is contained in:
刘祥超
2021-01-17 20:12:21 +08:00
parent f7054c69e9
commit e7ea92ff2f
6 changed files with 186 additions and 4 deletions

View File

@@ -12,3 +12,18 @@ func TestLoadAPIConfig(t *testing.T) {
}
t.Log(config)
}
func TestAPIConfig_WriteFile(t *testing.T) {
config := &APIConfig{
RPC: struct {
Endpoints []string `yaml:"endpoints"`
}{},
NodeId: "1",
Secret: "2",
}
err := config.WriteFile("/tmp/api_config.yaml")
if err != nil {
t.Fatal(err)
}
t.Log("ok")
}