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)
| 90 | // app.Configure(iris.WithConfiguration(iris.YAML("myconfig.yml"))) or |
| 91 | // app.Run([iris.Runner], iris.WithConfiguration(iris.YAML("myconfig.yml"))). |
| 92 | func 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: |
searching dependent graphs…