MCPcopy Create free account
hub / github.com/devspace-sh/devspace / ParseProfile

Function ParseProfile

pkg/devspace/config/versions/versions.go:56–82  ·  view source on GitHub ↗

ParseProfile loads the base config & a certain profile

(ctx context.Context, basePath string, data map[string]interface{}, profiles []string, update bool, disableProfileActivation bool, resolver variable.Resolver, log log.Logger)

Source from the content-addressed store, hash-verified

54
55// ParseProfile loads the base config & a certain profile
56func ParseProfile(ctx context.Context, basePath string, data map[string]interface{}, profiles []string, update bool, disableProfileActivation bool, resolver variable.Resolver, log log.Logger) ([]*latest.ProfileConfig, error) {
57 parsedProfiles := []*latest.ProfileConfig{}
58
59 // auto activated root level profiles
60 activatedProfiles := []string{}
61 if !disableProfileActivation {
62 var err error
63 activatedProfiles, err = getActivatedProfiles(ctx, data, resolver, log)
64 if err != nil {
65 return nil, err
66 }
67 }
68
69 // Combine auto activated profiles with flag activated profiles
70 profiles = append(activatedProfiles, profiles...)
71 profiles = filterProfileParents(profiles)
72
73 // check if there are profile parents
74 for i := len(profiles) - 1; i >= 0; i-- {
75 err := getProfiles(ctx, basePath, data, profiles[i], &parsedProfiles, 1, update, log)
76 if err != nil {
77 return nil, err
78 }
79 }
80
81 return parsedProfiles, nil
82}
83
84// Get parses only the key from the config
85func Get(data map[string]interface{}, keys ...string) (map[string]interface{}, error) {

Callers 1

applyProfilesMethod · 0.92

Calls 3

getActivatedProfilesFunction · 0.85
filterProfileParentsFunction · 0.85
getProfilesFunction · 0.85

Tested by

no test coverage detected