MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / LoadClusterConfig

Function LoadClusterConfig

internal/configs/cluster_config.go:33–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func LoadClusterConfig() (*ClusterConfig, error) {
34 for _, filename := range []string{"api_cluster.yaml", "cluster.yaml"} {
35 data, err := os.ReadFile(Tea.ConfigFile(filename))
36 if err != nil {
37 if os.IsNotExist(err) {
38 continue
39 }
40 return nil, err
41 }
42
43 var config = &ClusterConfig{}
44 err = yaml.Unmarshal(data, config)
45 if err != nil {
46 return config, err
47 }
48
49 err = config.Init()
50 if err != nil {
51 return nil, err
52 }
53
54 return config, nil
55 }
56 return nil, os.ErrNotExist
57}

Callers 3

TestLoadClusterConfigFunction · 0.92
checkClusterConfigMethod · 0.92
mainFunction · 0.92

Calls 1

InitMethod · 0.65

Tested by 1

TestLoadClusterConfigFunction · 0.74