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

Function LoadAppConfig

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

584
585// LoadAppConfig loads config from path. Returns nil, nil if file does not exist.
586func LoadAppConfig(path string) (*Config, error) {
587 data, err := os.ReadFile(path)
588 if err != nil {
589 if os.IsNotExist(err) {
590 return nil, nil
591 }
592 return nil, fmt.Errorf("read app config %s: %w", path, err)
593 }
594 var cfg Config
595 if err := json.Unmarshal(data, &cfg); err != nil {
596 return nil, fmt.Errorf("parse app config: %w", err)
597 }
598 return &cfg, nil
599}
600
601// supportedConfigKeys is the single source of truth for the top-level config
602// keys accepted by setConfigValue. The unknown-key error message is generated

Callers 7

previewMaxTokensFunction · 0.85
loadLLMRuntimeFunction · 0.85
runLLMTestWithConfigPathFunction · 0.85

Calls

no outgoing calls