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

Method applyProfiles

pkg/devspace/config/loader/loader.go:533–565  ·  view source on GitHub ↗
(ctx context.Context, data map[string]interface{}, options *ConfigOptions, resolver variable.Resolver, log log.Logger)

Source from the content-addressed store, hash-verified

531}
532
533func (l *configLoader) applyProfiles(ctx context.Context, data map[string]interface{}, options *ConfigOptions, resolver variable.Resolver, log log.Logger) (map[string]interface{}, error) {
534 // Get profile
535 profiles, err := versions.ParseProfile(ctx, filepath.Dir(l.absConfigPath), data, options.Profiles, options.ProfileRefresh, options.DisableProfileActivation, resolver, log)
536 if err != nil {
537 return nil, err
538 }
539
540 // Now delete not needed parts from config
541 delete(data, "profiles")
542
543 // Apply profiles
544 for i := len(profiles) - 1; i >= 0; i-- {
545 // Apply replace
546 err = ApplyReplace(data, profiles[i])
547 if err != nil {
548 return nil, err
549 }
550
551 // Apply merge
552 data, err = ApplyMerge(data, profiles[i])
553 if err != nil {
554 return nil, err
555 }
556
557 // Apply patches
558 data, err = ApplyPatches(data, profiles[i])
559 if err != nil {
560 return nil, err
561 }
562 }
563
564 return data, nil
565}
566
567// configExistsInPath checks whether a devspace configuration exists at a certain path
568func configExistsInPath(path string) bool {

Callers 1

parseConfigMethod · 0.95

Calls 4

ParseProfileFunction · 0.92
ApplyReplaceFunction · 0.85
ApplyMergeFunction · 0.85
ApplyPatchesFunction · 0.85

Tested by

no test coverage detected