MCPcopy Create free account
hub / github.com/astercloud/aster / Load

Function Load

pkg/appconfig/config.go:94–105  ·  view source on GitHub ↗

Load 从指定路径加载 YAML 配置。

(path string)

Source from the content-addressed store, hash-verified

92
93// Load 从指定路径加载 YAML 配置。
94func Load(path string) (*Config, error) {
95 data, err := os.ReadFile(path)
96 if err != nil {
97 return nil, fmt.Errorf("read config file: %w", err)
98 }
99
100 var cfg Config
101 if err := yaml.Unmarshal(data, &cfg); err != nil {
102 return nil, fmt.Errorf("parse config yaml: %w", err)
103 }
104 return &cfg, nil
105}

Callers

nothing calls this directly

Calls 1

ReadFileMethod · 0.45

Tested by

no test coverage detected