MCPcopy Create free account
hub / github.com/alibaba/open-code-review / LoadAppConfig

Function LoadAppConfig

cmd/opencodereview/config_cmd.go:300–313  ·  view source on GitHub ↗

LoadAppConfig loads config from path. Returns nil, nil if file does not exist.

(path string)

Source from the content-addressed store, hash-verified

298
299// LoadAppConfig loads config from path. Returns nil, nil if file does not exist.
300func LoadAppConfig(path string) (*Config, error) {
301 data, err := os.ReadFile(path)
302 if err != nil {
303 if os.IsNotExist(err) {
304 return nil, nil
305 }
306 return nil, fmt.Errorf("read app config %s: %w", path, err)
307 }
308 var cfg Config
309 if err := json.Unmarshal(data, &cfg); err != nil {
310 return nil, fmt.Errorf("parse app config: %w", err)
311 }
312 return &cfg, nil
313}
314
315func setConfigValue(cfg *Config, key, value string) error {
316 // Handle providers.<name>.<field> paths.

Callers 4

loadLLMRuntimeFunction · 0.85
runLLMTestFunction · 0.85

Calls

no outgoing calls

Tested by 2