MCPcopy Index your code
hub / github.com/kataras/iris / parseYAML

Function parseYAML

configuration.go:57–77  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

55}
56
57func 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//

Callers 2

YAMLFunction · 0.85

Calls 4

AbsMethod · 0.80
ErrorfMethod · 0.80
DefaultConfigurationFunction · 0.70
UnmarshalMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…