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)
| 54 | |
| 55 | // ParseProfile loads the base config & a certain profile |
| 56 | func 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 |
| 85 | func Get(data map[string]interface{}, keys ...string) (map[string]interface{}, error) { |
no test coverage detected