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

Function YAML

configuration.go:92–108  ·  view source on GitHub ↗

YAML reads Configuration from a configuration.yml file. Accepts the absolute path of the cfg.yml. An error will be shown to the user via panic with the error message. Error may occur when the cfg.yml does not exist or is not formatted correctly. Note: if the char '~' passed as "filename" then it t

(filename string)

Source from the content-addressed store, hash-verified

90// app.Configure(iris.WithConfiguration(iris.YAML("myconfig.yml"))) or
91// app.Run([iris.Runner], iris.WithConfiguration(iris.YAML("myconfig.yml"))).
92func YAML(filename string) Configuration {
93 // check for globe configuration file and use that, otherwise
94 // return the default configuration if file doesn't exist.
95 if filename == globalConfigurationKeyword {
96 filename = homeConfigurationFilename(".yml")
97 if _, err := os.Stat(filename); os.IsNotExist(err) {
98 panic("default configuration file '" + filename + "' does not exist")
99 }
100 }
101
102 c, err := parseYAML(filename)
103 if err != nil {
104 panic(err)
105 }
106
107 return c
108}
109
110// TOML reads Configuration from a toml-compatible document file.
111// Read more about toml's implementation at:

Callers 3

TestConfigurationGlobalFunction · 0.85
TestConfigurationYAMLFunction · 0.85
configuration.goFile · 0.85

Calls 3

parseYAMLFunction · 0.85
StatMethod · 0.45

Tested by 2

TestConfigurationGlobalFunction · 0.68
TestConfigurationYAMLFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…