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

Function LoadAppConfig

cmd/opencodereview/config_cmd.go:334–347  ·  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

332
333// LoadAppConfig loads config from path. Returns nil, nil if file does not exist.
334func LoadAppConfig(path string) (*Config, error) {
335 data, err := os.ReadFile(path)
336 if err != nil {
337 if os.IsNotExist(err) {
338 return nil, nil
339 }
340 return nil, fmt.Errorf("read app config %s: %w", path, err)
341 }
342 var cfg Config
343 if err := json.Unmarshal(data, &cfg); err != nil {
344 return nil, fmt.Errorf("parse app config: %w", err)
345 }
346 return &cfg, nil
347}
348
349// supportedConfigKeys is the single source of truth for the top-level config
350// keys accepted by setConfigValue. The unknown-key error message is generated

Callers 4

loadLLMRuntimeFunction · 0.85
runLLMTestFunction · 0.85

Calls

no outgoing calls

Tested by 2