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

Method LoadRaw

pkg/devspace/config/loader/loader.go:574–606  ·  view source on GitHub ↗

LoadRaw loads the raw config

()

Source from the content-addressed store, hash-verified

572
573// LoadRaw loads the raw config
574func (l *configLoader) LoadRaw() (map[string]interface{}, error) {
575 // What path should we use
576 configPath := ConfigPath(l.absConfigPath)
577 _, err := os.Stat(configPath)
578 if err != nil {
579 return nil, errors.Errorf("Couldn't load '%s': %v", configPath, err)
580 }
581
582 fileContent, err := os.ReadFile(configPath)
583 if err != nil {
584 return nil, err
585 }
586
587 rawMap := map[string]interface{}{}
588 err = yamlutil.Unmarshal(fileContent, &rawMap)
589 if err != nil {
590 return nil, err
591 }
592
593 name, ok := rawMap["name"].(string)
594 if !ok || name == "" {
595 directoryName := filepath.Base(filepath.Dir(l.absConfigPath))
596 if directoryName != "" && len(directoryName) > 2 {
597 name = encoding.Convert(directoryName)
598 } else {
599 name = "devspace"
600 }
601
602 rawMap["name"] = name
603 }
604
605 return rawMap, nil
606}
607
608// Exists checks whether the yaml file for the config exists or the configs.yaml exists
609func (l *configLoader) Exists() bool {

Callers 1

LoadWithParserMethod · 0.95

Calls 4

UnmarshalFunction · 0.92
ConvertFunction · 0.92
ConfigPathFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected