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

Function LoadAppConfig

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

262
263// LoadAppConfig loads config from path. Returns nil, nil if file does not exist.
264func LoadAppConfig(path string) (*Config, error) {
265 data, err := os.ReadFile(path)
266 if err != nil {
267 if os.IsNotExist(err) {
268 return nil, nil
269 }
270 return nil, fmt.Errorf("read app config %s: %w", path, err)
271 }
272 var cfg Config
273 if err := json.Unmarshal(data, &cfg); err != nil {
274 return nil, fmt.Errorf("parse app config: %w", err)
275 }
276 return &cfg, nil
277}
278
279func setConfigValue(cfg *Config, key, value string) error {
280 // Handle providers.<name>.<field> paths.

Callers 4

loadLLMRuntimeFunction · 0.85
runLLMTestFunction · 0.85

Calls

no outgoing calls

Tested by 2