Reads a YAML file and populates a string -> string map. Throws an error if the file name is empty.
(variablesFile string)
| 218 | // Reads a YAML file and populates a string -> string map. |
| 219 | // Throws an error if the file name is empty. |
| 220 | func createVariablesMapFromFile(variablesFile string) (map[string]string, error) { |
| 221 | if variablesFile == "" { |
| 222 | return nil, xerrors.Errorf("variable file name is not specified") |
| 223 | } |
| 224 | |
| 225 | variablesMap := make(map[string]string) |
| 226 | variablesFileContents, err := os.ReadFile(variablesFile) |
| 227 | if err != nil { |
| 228 | return nil, err |
| 229 | } |
| 230 | |
| 231 | err = yaml.Unmarshal(variablesFileContents, &variablesMap) |
| 232 | if err != nil { |
| 233 | return nil, err |
| 234 | } |
| 235 | return variablesMap, nil |
| 236 | } |
| 237 | |
| 238 | func parseVariableValuesFromCommandLine(variables []string) ([]VariableValue, error) { |
| 239 | var values []VariableValue |
no test coverage detected