MCPcopy Index your code
hub / github.com/devspace-sh/devspace / parseConfig

Function parseConfig

cmd/root.go:321–358  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

319}
320
321func parseConfig(f factory.Factory) (*RawConfig, error) {
322 // get current working dir
323 cwd, err := os.Getwd()
324 if err != nil {
325 return nil, err
326 }
327
328 // set working dir back to original
329 defer func() { _ = os.Chdir(cwd) }()
330
331 // Set config root
332 configLoader, err := f.NewConfigLoader("")
333 if err != nil {
334 return nil, err
335 }
336 configExists, err := configLoader.SetDevSpaceRoot(log.Discard)
337 if err != nil {
338 return nil, err
339 } else if !configExists {
340 return nil, errors.New(message.ConfigNotFound)
341 }
342
343 // Parse commands
344 timeoutCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
345 defer cancel()
346
347 r := &RawConfig{
348 resolved: map[string]string{},
349 }
350 _, err = configLoader.LoadWithParser(timeoutCtx, nil, nil, r, &loader.ConfigOptions{
351 Dry: true,
352 }, log.Discard)
353 if r.Resolver != nil {
354 return r, nil
355 }
356
357 return nil, err
358}
359
360type RawConfig struct {
361 Ctx context.Context

Callers 1

BuildRootFunction · 0.85

Calls 4

SetDevSpaceRootMethod · 0.95
LoadWithParserMethod · 0.95
WithTimeoutMethod · 0.80
NewConfigLoaderMethod · 0.65

Tested by

no test coverage detected