MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Load

Function Load

internal/camconfig/camconfig.go:57–74  ·  view source on GitHub ↗

Load returns the parsed config.yaml. When path is empty the canonical location is consulted; when that file is missing the bundled defaults are returned instead so the CLI keeps working on a fresh install.

(path string)

Source from the content-addressed store, hash-verified

55// location is consulted; when that file is missing the bundled defaults are
56// returned instead so the CLI keeps working on a fresh install.
57func Load(path string) (CamConfig, error) {
58 if path == "" {
59 path = DefaultPath()
60 }
61 data, err := os.ReadFile(path)
62 if err != nil {
63 if os.IsNotExist(err) {
64 return Bundled()
65 }
66 return CamConfig{}, fmt.Errorf("camconfig: read %s: %w", path, err)
67 }
68 cfg, parseErr := parse(data)
69 if parseErr != nil {
70 return CamConfig{}, fmt.Errorf("camconfig: parse %s: %w", path, parseErr)
71 }
72 cfg.Cache.Directory = pathutil.Expand(cfg.Cache.Directory)
73 return cfg, nil
74}
75
76// Bundled returns the parsed bundled config.yaml shipped with the binary.
77// Used as a fallback when no user file is present and exposed so tests can

Callers 7

ShowMethod · 0.92
ValidateMethod · 0.92
identifyLocalRepoKeysFunction · 0.92
TestLoadParsesUserFileFunction · 0.92
LoadAllFunction · 0.92

Calls 5

ExpandFunction · 0.92
BundledFunction · 0.85
parseFunction · 0.85
ReadFileMethod · 0.80
DefaultPathFunction · 0.70