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

Function LoadAppConfig

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

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