Get parses only the key from the config
(data map[string]interface{}, keys ...string)
| 83 | |
| 84 | // Get parses only the key from the config |
| 85 | func Get(data map[string]interface{}, keys ...string) (map[string]interface{}, error) { |
| 86 | retMap := map[string]interface{}{} |
| 87 | err := util.Convert(data, &retMap) |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | |
| 92 | retConfig := map[string]interface{}{ |
| 93 | "version": retMap["version"], |
| 94 | "name": retMap["name"], |
| 95 | } |
| 96 | for _, key := range keys { |
| 97 | keyData, ok := retMap[key] |
| 98 | if ok { |
| 99 | retConfig[key] = keyData |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | return retConfig, nil |
| 104 | } |
| 105 | |
| 106 | // ParseVariables parses only the variables from the config |
| 107 | func ParseVariables(data map[string]interface{}, log log.Logger) (map[string]*latest.Variable, error) { |
no outgoing calls
no test coverage detected