GO WEB IRIS入门(三)配置文件

加载配置文件 YAML

创建一个iris.yml

FireMethodNotAllowed: true
DisableBodyConsumptionOnUnmarshal: true
TimeFormat: Mon, 01 Jan 2006 15:04:05 GMT
Charset: UTF-8

然后到go主函数中去调用。

config := iris.WithConfiguration(iris.YAML("./iris.yml"))
app.Run(iris.Addr(":8080"), config)

加载配置文件TOML

写配置文件iris.tml

FireMethodNotAllowed = true
DisableBodyConsumptionOnUnmarshal = false
TimeFormat = "Mon, 01 Jan 2006 15:04:05 GMT"
Charset = "UTF-8"

[Other]
    ServerName = "my fancy iris server"
    ServerOwner = "[email protected]"

然后加载进入主函数

config := iris.WithConfiguration(iris.TOML("./iris.tml"))
app.Run(iris.Addr(":8080"), config)

更多信息请看官网

你可能感兴趣的:(go,GOWEB,Experience)