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

Function LoadAppConfig

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

339
340// LoadAppConfig loads config from path. Returns nil, nil if file does not exist.
341func LoadAppConfig(path string) (*Config, error) {
342 data, err := os.ReadFile(path)
343 if err != nil {
344 if os.IsNotExist(err) {
345 return nil, nil
346 }
347 return nil, fmt.Errorf("read app config %s: %w", path, err)
348 }
349 var cfg Config
350 if err := json.Unmarshal(data, &cfg); err != nil {
351 return nil, fmt.Errorf("parse app config: %w", err)
352 }
353 return &cfg, nil
354}
355
356// supportedConfigKeys is the single source of truth for the top-level config
357// 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