MCPcopy Index your code
hub / github.com/jetify-com/devbox / Open

Function Open

internal/devconfig/config.go:90–102  ·  view source on GitHub ↗

Open loads a Devbox config from a file or project directory. If path is a directory, Open looks for a well-known config name (such as devbox.json) within it. The error will be [ErrNotFound] if path is a valid directory without a config file. Open does not recursively search outside of path. See [Fi

(path string)

Source from the content-addressed store, hash-verified

88// Open does not recursively search outside of path. See [Find] to load a config
89// by walking up the directory tree.
90func Open(path string) (*Config, error) {
91 start := time.Now()
92 slog.Debug("searching for config file (excluding parent directories)", "path", path)
93
94 cfg, err := open(path)
95
96 if err == nil {
97 slog.Debug("config file found", "path", cfg.Root.AbsRootPath, "dur", time.Since(start))
98 } else {
99 slog.Error("config file search error", "err", err.Error(), "dur", time.Since(start))
100 }
101 return cfg, err
102}
103
104func open(path string) (*Config, error) {
105 // First try the happy path by assuming that path is a directory

Callers 11

RunDevboxTestscriptsFunction · 0.92
OpenFunction · 0.92
TestOpenFunction · 0.70
TestOpenErrorFunction · 0.70
TestAliasesFunction · 0.70
TestAliasesEmptyFunction · 0.70
TestAliasesInvalidFunction · 0.70
TestDefaultFunction · 0.70

Calls 2

openFunction · 0.85
ErrorMethod · 0.45

Tested by 9

TestOpenFunction · 0.56
TestOpenErrorFunction · 0.56
TestAliasesFunction · 0.56
TestAliasesEmptyFunction · 0.56
TestAliasesInvalidFunction · 0.56
TestDefaultFunction · 0.56