mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 15:00:26 +08:00
可以直接在节点启动时自动注册节点
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
// 节点API配置
|
||||
type APIConfig struct {
|
||||
RPC struct {
|
||||
Endpoints []string `yaml:"endpoints"`
|
||||
@@ -28,3 +29,13 @@ func LoadAPIConfig() (*APIConfig, error) {
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// 保存到文件
|
||||
func (this *APIConfig) WriteFile(path string) error {
|
||||
data, err := yaml.Marshal(this)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(path, data, 0666)
|
||||
return err
|
||||
}
|
||||
|
||||
10
internal/configs/cluster_config.go
Normal file
10
internal/configs/cluster_config.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package configs
|
||||
|
||||
// 集群配置
|
||||
type ClusterConfig struct {
|
||||
RPC struct {
|
||||
Endpoints []string `yaml:"endpoints"`
|
||||
} `yaml:"rpc"`
|
||||
ClusterId string `yaml:"clusterId"`
|
||||
Secret string `yaml:"secret"`
|
||||
}
|
||||
Reference in New Issue
Block a user