(filename string)
| 55 | } |
| 56 | |
| 57 | func parseYAML(filename string) (Configuration, error) { |
| 58 | c := DefaultConfiguration() |
| 59 | // get the abs |
| 60 | // which will try to find the 'filename' from current workind dir too. |
| 61 | yamlAbsPath, err := filepath.Abs(filename) |
| 62 | if err != nil { |
| 63 | return c, fmt.Errorf("parse yaml: %w", err) |
| 64 | } |
| 65 | |
| 66 | // read the raw contents of the file |
| 67 | data, err := os.ReadFile(yamlAbsPath) |
| 68 | if err != nil { |
| 69 | return c, fmt.Errorf("parse yaml: %w", err) |
| 70 | } |
| 71 | |
| 72 | // put the file's contents as yaml to the default configuration(c) |
| 73 | if err := yaml.Unmarshal(data, &c); err != nil { |
| 74 | return c, fmt.Errorf("parse yaml: %w", err) |
| 75 | } |
| 76 | return c, nil |
| 77 | } |
| 78 | |
| 79 | // YAML reads Configuration from a configuration.yml file. |
| 80 | // |
searching dependent graphs…